| |
| |
|
|
|
|
| |
|
| |
|
| :: |
| Author |
Message |
VonHelvete
Joined: 02 Jun 2008 Posts: 1 Location: Sweden
|
Posted: Mon Jun 02, 2008 11:37 pm Post subject: 301 redirect dynamic pages in htacess Apache I'm going nuts |
|
|
Howdy guys! I have a SEO config setup by a company in my htacess which makes my whole webstore SEO friendly and to html. Problem is I need to redirect 301 all my old products, categories, documents to the new urls but I will stay on the same domain.
I have read, searched, tried everything for 2-3 days now and I'm going insane! I know it must be something easy for someone that have some experience but I'm a newbie and need some help
What I want/need to do for all my old pages is redirect like
| Code: | | THIS: http://www.domain.se/view_product.php?product=N811 TO: http://www.domain.se/panos-bikini-20/panos-bikini-bastia-17.html |
Anyone? Seems like the dynamic url is the reason that I can't get it working since I tried with static and it worked fine =/
Thanks in advance!!!!  |
|
|
| Back to top |
|
 |
|
 |
SeO Administrateur - Site Admin

Joined: 15 Mar 2006 Posts: 3477
|
Posted: Tue Jun 03, 2008 8:06 am Post subject: Re: 301 redirect dynamic pages in htacess Apache I'm going nuts |
|
|
Well, the problem is, this cannot be done through the .htaccess, unless you're ready to implement a rewriterule per page, because the title is not know before php/mysql retrieves it, and the .htaccess is processed before php.
So, the solution is to do it in the php script, like we do for phpBB3 with the zero duplicate, eg :
- At the beginning of the script, grab the uri ($_SERVER['REQUEST_URI']), in you example you should end up with : view_product.php?product=N811
- As soon as the product tile is queried for in the script, build the attended uri => panos-bikini-20/panos-bikini-bastia-17.html
- and compare the two. Using the = sign may be harder to set up for the edge cases, strpos() can be a good compromise in some circumstances (is the uri grabbed part of the attended uri ?)
- redirect upon negative match (= or strpos) using an http 301 header. This must be done before the script starts to output any content.
Depending on your script it may be more or less difficult to implement, but the principle is rather simple. |
_________________ phpBB SEO || SEO Forum || Forum Référencement
GYM Sitemap & RSS for phpBB3 has been released ! || GYM Sitemap & RSS for phpBB3 est disponible ! |
|
| Back to top |
|
 |
|
| Navigation |
Similar Topics |
|
|
|
|
|
|
|
| |
|
|
|
|
| |
|
|
|
|
| |