Forum Moderators: phranque
I've searched the board (probably using the wrong search terms) and can't find the answer.
We are moving from a database driven format to a traditional html format on another domain for a site and need to redirect traffic from the old site to the new.
I know I need to use a 301 and have the following in the .htaccess file :-
----------
RewriteEngine On
# Redirect parameter requests for old 'dynamic' URLs to equivalent new static URLs on new site
RewriteCond %{QUERY_STRING} .
RewriteRule (.*) [domain2.co.uk...] [R=301,L]
----
This, as I understand it should sends from domain1.co.uk/?page=1 to the home page of domain2.co.uk with no parameter.
The old site is based around domain1.co.uk/?page=1 where page is a single parameter that calls the details from a database (via code in the home page). The new site is structured as domain2.co.uk/page1.html so I need to basically take the parameter and add it to the end of the rewrite rule with a .html on the end.
I know that this board is not to write the code for me but wondered if anyone could provide a hint.
Thanks
John
In case anyone else wants to to this my .htaccess now reads :-
--------------
RewriteEngine On
# Externally redirect client requests for old dynamic URLs to equivalent new static URLs
RewriteCond %{QUERY_STRING} (.*)page=(.*)
RewriteRule .? [domain2.co.uk%{REQUEST_URI}%2\.html?...] [R=301,L]
---------------