katlis Posted March 1, 2009 Share Posted March 1, 2009 I can't wrap my head around this one... RewriteEngine on RewriteCond %{HTTP_HOST} ^domain.com$ [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301] RewriteRule ^tutorial/([A-Za-z0-9-]+)/?$ /tutorial.php?id=$1 [NC] Going to http://domain.com/tutorial/blah will redirect to http://www.domain.com/tutorial.php?id=blah I want it to go to http://www.domain.com/tutorial/blah. What's goin on here? Link to comment https://forums.phpfreaks.com/topic/147477-friendly-url-with-www-redirect-not-working/ Share on other sites More sharing options...
corbin Posted March 1, 2009 Share Posted March 1, 2009 Try changing RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301] To RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] Link to comment https://forums.phpfreaks.com/topic/147477-friendly-url-with-www-redirect-not-working/#findComment-774105 Share on other sites More sharing options...
katlis Posted March 4, 2009 Author Share Posted March 4, 2009 Thanks, that worked! What does the L do? Link to comment https://forums.phpfreaks.com/topic/147477-friendly-url-with-www-redirect-not-working/#findComment-776525 Share on other sites More sharing options...
corbin Posted March 4, 2009 Share Posted March 4, 2009 Makes the rule with the [L] flag the last rule that will be ran. So, in this case, it stops the second rewrite from happening if the first one happens. Link to comment https://forums.phpfreaks.com/topic/147477-friendly-url-with-www-redirect-not-working/#findComment-776715 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.