wemustdesign Posted May 27, 2010 Share Posted May 27, 2010 I was using this rewrite rule in my .htaccess for my courses page: RewriteRule ^([^/\.]+)/region/([^/\.]+)/?$ index.php?uk=$1®ion=$2 [L] output: area/region/sample_area I have changed the structure of the URL's mainly because of seo. I have now added this rule which is: RewriteRule ^course([^/\.]+)/([^/\.]+)/?$ index.php?region=$2&uk=$1 [L] output: coursearea/sample_area The problem I have now is that this page now has 2 url's with the same content on. I cannot simply delete the first rewrite rule as it is still on Googles search results. So I am wanting to redirect area/region/sample_area to coursearea/sample_area I have no idea how to do this, have tried everything. Any ideas appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/203089-htaccess-question/ Share on other sites More sharing options...
cags Posted May 27, 2010 Share Posted May 27, 2010 I think you want something like this... RewriteRule ^([^/\.]+)/region/([^/\.]+)/?$ course$1/$2 [R=302] Once you know it's linking you to the right page you can change the 302 (temporary forward) to a 301 (permanent forward), but doing so before hand will make it hard to test/debug. Quote Link to comment https://forums.phpfreaks.com/topic/203089-htaccess-question/#findComment-1064153 Share on other sites More sharing options...
wemustdesign Posted May 27, 2010 Author Share Posted May 27, 2010 Worked like a charm, thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/203089-htaccess-question/#findComment-1064189 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.