Hi all. I enabled pretty urls and it works great. However, I still get search traffic going to the old urls (;http://www.mysite.co.uk/index.php?page=who) and google sitemaps is throwing up a duplicate title tags issue (its treating the two urls as separate pages. So I wanted to force queries to resolve to the new urls using htaccess file.
Conventional "Redirect 301 /index.php?page=who ;http://www.mysite.com/who.html" does not work. The closest I've got is:
RewriteCond %{QUERY_STRING} ^page=who$
RewriteRule ^index.php$ who.html [R=301,L]
But that resolves to:http://www.mysite.com/who.html?page=who
Apart from that amend I'm using the standard htaccess file form latest version of cmsms.
Can anyone help? Thanks
cannot htaccess 301 redirect, with pretty urls enabled
cannot htaccess 301 redirect, with pretty urls enabled
Last edited by Dr.CSS on Fri Jan 31, 2014 4:21 pm, edited 1 time in total.
Reason: Please use double quotes or something on fake links so they aren't clickable...
Reason: Please use double quotes or something on fake links so they aren't clickable...
Re: cannot htaccess 301 redirect, with pretty urls enabled
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: cannot htaccess 301 redirect, with pretty urls enabled
It's all about canonical urls.
You should NOT 301 those requests. Google for 'canonical url' and look at some sample templates. Use that to tell Google and frieds what url they should index.
You should NOT 301 those requests. Google for 'canonical url' and look at some sample templates. Use that to tell Google and frieds what url they should index.
Re: cannot htaccess 301 redirect, with pretty urls enabled
Since Google has already indexed your old URLs using the page= query, you can tell Google in your Webmasters account do not index query strings.However, I still get search traffic going to the old urls (;http://www.mysite.co.uk/index.php?page=who) and google sitemaps is throwing up a duplicate title tags issue (its treating the two urls as separate pages.
Also in your robots.txt file, you can try adding something like:
Disallow: /index.php?page
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo
--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
Re: cannot htaccess 301 redirect, with pretty urls enabled
Hi guys. Thanks for the replys. I think I'll use webmasters tools to specify the preffered urls, as you suggested. Rolf, thanks for the link, but this was the first place I went to when I was searching for a solution. I could not get any of the four rewrites to work:
RewriteRule ^old/path/to/something.html$ ;http://www.website.com/new/path/to/something [R=301,L]
RewriteRule ^something$ ;http://www.website.com/something [R=301,L]
RewriteRule ^something/$ ;http://www.website.com/something/ [R=301,L]
RewriteRule something.html$ ;http://www.website.com/something [R=301,L]
I wondered if one of the characters in my string was interfering and needed to be escaped (the above examples are all simple .html files). I tried things like:
RewriteRule ^index.php?page=who$ ;http://www.website.com/who.html [R=301,L]
Should this have worked?
RewriteRule ^old/path/to/something.html$ ;http://www.website.com/new/path/to/something [R=301,L]
RewriteRule ^something$ ;http://www.website.com/something [R=301,L]
RewriteRule ^something/$ ;http://www.website.com/something/ [R=301,L]
RewriteRule something.html$ ;http://www.website.com/something [R=301,L]
I wondered if one of the characters in my string was interfering and needed to be escaped (the above examples are all simple .html files). I tried things like:
RewriteRule ^index.php?page=who$ ;http://www.website.com/who.html [R=301,L]
Should this have worked?
Last edited by Dr.CSS on Mon Feb 03, 2014 4:25 pm, edited 1 time in total.
Reason: Please use double quotes or something on fake links so they aren't clickable...
Reason: Please use double quotes or something on fake links so they aren't clickable...
Re: cannot htaccess 301 redirect, with pretty urls enabled
Actually a dot should be escaped. But it will work anyway because it stands for 'any character'.
But again: you probably don't want this. I'm not sure if you wouldn't generate an endless loop this way. In the end, cmsms needs the 'index.php?page=who'
But again: you probably don't want this. I'm not sure if you wouldn't generate an endless loop this way. In the end, cmsms needs the 'index.php?page=who'