Canonicalization Issue
10 posts
• Page 1 of 1
- seanpearse
- Posts: 5
- Joined: 14 Jan 2013, 13:58
Canonicalization Issue
Hi Everyone,
I'm new on here and pretty new to ISAPI so any help is much appreciated.
I'm trying to improve the on-site seo of a wordpress site that runs on IIS (I know!). The structure of the site is a bit of a disaster and to make things more complicated the designer has set certain file permissions that I'm struggling to get my head around. I basically want to redirect the www. version to the non-www. version and also redirect all /index.php to the root.
Here's what I've got to so far:
#This was the existing .htaccess contents controlling folder restrictions
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
#And this is what I added to sort out the canonicalisation
RewriteEngine on
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^www\.(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://%2%3 [R=301]
RewriteRule ^index\.php$ http://thetaxclinic.ie/ [NC,R=301,L]
It's working as I want it to on the home page but the redirects aren't having any affect on any of the site's inner pages. Can anyone shed some light on what I'm doing wrong?
Thanks in advance,
Sean.
I'm new on here and pretty new to ISAPI so any help is much appreciated.
I'm trying to improve the on-site seo of a wordpress site that runs on IIS (I know!). The structure of the site is a bit of a disaster and to make things more complicated the designer has set certain file permissions that I'm struggling to get my head around. I basically want to redirect the www. version to the non-www. version and also redirect all /index.php to the root.
Here's what I've got to so far:
#This was the existing .htaccess contents controlling folder restrictions
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
#And this is what I added to sort out the canonicalisation
RewriteEngine on
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^www\.(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://%2%3 [R=301]
RewriteRule ^index\.php$ http://thetaxclinic.ie/ [NC,R=301,L]
It's working as I want it to on the home page but the redirects aren't having any affect on any of the site's inner pages. Can anyone shed some light on what I'm doing wrong?
Thanks in advance,
Sean.
Re: Canonicalization Issue
Hello, Sean
Can you give an example of the page where the redirect doesn't work as expected.
Can you give an example of the page where the redirect doesn't work as expected.
- seanpearse
- Posts: 5
- Joined: 14 Jan 2013, 13:58
Re: Canonicalization Issue
Hi Anton,
Thanks for your response.
As I've mentioned, the site is http://thetaxclinic.ie and the redirects are all working fine on the home page. i.e. It's redirecting to the preferred non-www version and both thetaxclinic.ie/index.php & thetaxclinic.ie/home are redirecting as I want them to but these redirects aren't having any affect on the inner pages.
e.g. http://thetaxclinic.ie/index.php/tax-refunds/
I've just noticed actually that if I enter the url http://WWW.thetaxclinic.ie/index.php/tax-refunds/ it redirects back to the non-www version
but if I enter
WWW.thetaxclinic.ie/tax-refunds/ it doesn't redirect to the non-www version.
The set up of the site is a bit of a disaster to be honest. Why anyone would load wordpress onto IIS is beyond me but here we are regardless.
Any help is much appreciated.
Cheers,
Sean
Thanks for your response.
As I've mentioned, the site is http://thetaxclinic.ie and the redirects are all working fine on the home page. i.e. It's redirecting to the preferred non-www version and both thetaxclinic.ie/index.php & thetaxclinic.ie/home are redirecting as I want them to but these redirects aren't having any affect on the inner pages.
e.g. http://thetaxclinic.ie/index.php/tax-refunds/
I've just noticed actually that if I enter the url http://WWW.thetaxclinic.ie/index.php/tax-refunds/ it redirects back to the non-www version
but if I enter
WWW.thetaxclinic.ie/tax-refunds/ it doesn't redirect to the non-www version.
The set up of the site is a bit of a disaster to be honest. Why anyone would load wordpress onto IIS is beyond me but here we are regardless.
Any help is much appreciated.
Cheers,
Sean
Re: Canonicalization Issue
Hello, Sean
It occurred to me that your problems might be because you might be using v3 syntax in ISAPI_Rewrite 2.
Do you really use v2? Please confirm.
It occurred to me that your problems might be because you might be using v3 syntax in ISAPI_Rewrite 2.
Do you really use v2? Please confirm.
- seanpearse
- Posts: 5
- Joined: 14 Jan 2013, 13:58
Re: Canonicalization Issue
I've just had a look and it seems you could be on to something, I've just done a bit of research and apparently the name server that the site is on has isapi v3 built in! I read somewhere previously that the host (Blacknight) used ISAPI_Rewrite 2 but this doesn't seem to be the case.
Is the syntax I'm using correct for version 2? I just need to get the corresponding version for V3?
Thanks again for your assistance.
Is the syntax I'm using correct for version 2? I just need to get the corresponding version for V3?
Thanks again for your assistance.
Re: Canonicalization Issue
Hello, Sean
The syntax you currently have is for v3. I just noticed that you posted the question in v2 forum, so I was unsure.
Please enable logging in httpd.conf by putting
RewriteLogLevel 9
LogLevel debug
Then make the test request that doesn't work and provide rewrite.log and error.log records you get.
The syntax you currently have is for v3. I just noticed that you posted the question in v2 forum, so I was unsure.
Please enable logging in httpd.conf by putting
RewriteLogLevel 9
LogLevel debug
Then make the test request that doesn't work and provide rewrite.log and error.log records you get.
- seanpearse
- Posts: 5
- Joined: 14 Jan 2013, 13:58
Re: Canonicalization Issue
Sorry for the late response. I tried a few times and can't find the httpd.conf file anywhere in the root.
Should I just create one? If so where should it be placed?
Apologies for my obvious ignorance on the subject.
Should I just create one? If so where should it be placed?
Apologies for my obvious ignorance on the subject.
Re: Canonicalization Issue
Hello, Sean
httpd.conf file in located in ISAPI_Rewrite installation folder.
You should put the logging directives into it.
httpd.conf file in located in ISAPI_Rewrite installation folder.
You should put the logging directives into it.
- seanpearse
- Posts: 5
- Joined: 14 Jan 2013, 13:58
Re: Canonicalization Issue
Anton thanks again for your patience and assistance. The client is on a shared hosting plan and I can't access the IIS Manager or the ISAPI_Rewrite installation folder.
Are there any other alternatives? If not, I'll not worry too much about it. I've got the brunt of it sorted out but it's just annoying more than anything.
Sorry to be a pest.
Are there any other alternatives? If not, I'll not worry too much about it. I've got the brunt of it sorted out but it's just annoying more than anything.
Sorry to be a pest.
Re: Canonicalization Issue
Hello, Sean
Could you try to fix your last rule like this:
RewriteRule ^index\.php(.*)$ http://thetaxclinic.ie$1 [NC,R=301,L]
Ans see if the behavior will change or not.
Could you try to fix your last rule like this:
RewriteRule ^index\.php(.*)$ http://thetaxclinic.ie$1 [NC,R=301,L]
Ans see if the behavior will change or not.
10 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 10 guests