This is a discussion on How to redirect within the Apache Web Server forums, part of the Web Server and Related Forums category; I'm transferring my site from static pages which are all called www.mysite.com/[productcode].html, to a PHP ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm transferring my site from static pages which are all called
www.mysite.com/[productcode].html, to a PHP solution that will have one standard product page (product.php) and will take the product code to display as a parameter eg www.mysite.com\product.php?id=12345 I'd like to make sure that all search engine links and other links that currently go straight to an HTML product page will still be able to find the correct page, so I thought I'd see if it can be done with a .htaccess redirect. eg redirect *.html *.php?id=????? (syntax obviously not perfect!) I'm hopeless at the expression parsing bit of htaccess and wondered if anyone has done a similar thing before. I will need to be able to exclude certain files (eg index.html) from the redirects, although I could even get round this if it's not possible. |
|
|||
|
Andy Rigby <ecol1111@yahoo.co.uk> wrote:
> to find the correct page, so I thought I'd see if it can be done with > a .htaccess redirect. I think you'll need some rewrite rule in order to do so. See the documentation for mod_rewrite. Davide -- | Well, if you can't believe what you read in a comic book, what can | you believe?! | | |
|
|||
|
It's the HTACCESS file I really need to find out about. I'm familiar
with editing it, as I've used it before, but I find it really hard to get my head around the expression parsing syntax when it comes to only redirecting certain page requests. Andy ecol1111@yahoo.co.uk (Andy Rigby) wrote in message news:<d7d8dd25.0406040623.7a2e1bf7@posting.google. com>... > I'm transferring my site from static pages which are all called > www.mysite.com/[productcode].html, to a PHP solution that will have one standard > product page (product.php) and will take the product code to display > as a parameter eg www.mysite.com\product.php?id=12345 > > I'd like to make sure that all search engine links and other links > that currently go straight to an HTML product page will still be able > to find the correct page, so I thought I'd see if it can be done with > a .htaccess redirect. > > eg > > redirect *.html *.php?id=????? (syntax obviously not perfect!) > > I'm hopeless at the expression parsing bit of htaccess and wondered if > anyone has done a similar thing before. I will need to be able to > exclude certain files (eg index.html) from the redirects, although I > could even get round this if it's not possible. |
|
|||
|
ecol1111@yahoo.co.uk (Andy Rigby) wrote in message news:<d7d8dd25.0406070053.432aae78@posting.google. com>...
> It's the HTACCESS file I really need to find out about. I'm familiar > with editing it, as I've used it before, but I find it really hard to > get my head around the expression parsing syntax when it comes to only > redirecting certain page requests. > > Andy > Oh sorry, now I see what you mean....use RewriteRule in my htaccess file. OK so I've tried that and got a bit further. I can now redirect to the 'master' page and supply a parameter to it. The last thing I've got to figure out is how to NOT do the redirect for certain pages (eg index.html) Andy |