1

I want to make a existing site seo friendly URLs. I have almost there and rewrite all links. But when it comes to 301 redirect old URL's to new ones, where I got stuck. Here below how I have done it.

RewriteEngine On
RewriteRule ^video_gallery video_gallery.php
Redirect /video_gallery.php http://site.com/video_gallery

So as illustrated above I have rewritten the video_gallary.php to video_gallary and now I want to redirect all requests with http://site.com/video_gallery.php to http://site.com/video_gallery But its now working properly as above. A lil help here please.

Thank you

4

1 回答 1

1

This will cause a redirect loop. You need to match against the %{THE_REQUEST} variable which is the actual request, not the URI (which gets changed through the course of processing). So using your example:

RewriteEngine On

RewriteRule ^video_gallery video_gallery.php

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /video_gallery\.php
RewriteRule ^ /video_gallery [L,R=301]
于 2013-04-26T05:39:35.387 回答