htaccess Redirect Issue
-
Hi I have scoured the forums for some answers but I have not found any, hence me starting a new thread.
I am working on a new site for a client and I have installed WordPress locally on my workstation running Win 7 Pro under WAMP andI am just adding some redirects to the htaccess file to redirect the old page urls to the equivalent new WordPress pages.
The old site I built for my client uses GET variables to load pages and for navigation, so the URL’s look like the example below.
https://www.somesite.co.uk/index.php?page=indexYou can also access the homepage using these URL’s as well.
https://www.somesite.co.uk/index.php
https://www.somesite.co.uk/
The new site has basically the same structure it just uses clean URL’s so I just want to deal with the old URL’s that contain GET values which Google has indexed and cached, so people end up in the right place if they click links in search results during the first month after launch, once Google has crawled indexed and cached the new pages I can remove the redirects.So far I have set up a few redirect rules locally to redirect the URL’s of the old site pages to the new site pages and they work OK, I paste the URL into the address bar hit enter and WordPress does the right thing and I end up on the right page as expected.
The only problem is that the GET name, value pair are added to the end of the URL.So for example when I enter the old URL below
https://localhost/new-site.co.uk/about/index.php?page=index
After redirecting the URL looks like the example below
https://localhost/new-site.co.uk/about/?page=index
I get to the righ page, but the URL should look like the example below.
https://localhost/new-site.co.uk/about/I have placed the redirect rules at the top of the htaccess files above the WordPress rewrite rules here is an example.
# BEGIN Custom Redirects
Redirect 301 /about/index.php?page=index https://localhost/new-site.co.uk/about/
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /andrews-limousines.co.uk/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /andrews-limousines.co.uk/index.php [L]
</IfModule># END WordPress
There are no spaces at the begining of the file just a comment to describe the purpose of the rules and the redirect rules.
It would be great to get this working properly, any advice how to resolve this issue will be much appreciated.
Likkle More
- The topic ‘htaccess Redirect Issue’ is closed to new replies.