homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Redirect and use parameters as page name
sending www.domain1.co.uk/?page=1 to www.domain2.co.uk/page1.html

 12:24 pm on Jan 15, 2007 (gmt 0)

Hi there,

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.





 3:14 pm on Jan 15, 2007 (gmt 0)

Think I've cracked it ;-)

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]

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved