doubledee Posted January 2, 2012 Share Posted January 2, 2012 I have the following Mod_Rewrite... RewriteEngine on #PRETTY: articles/postage-meters-can-save-you-money #UGLY: article.php?slug=postage-meters-can-save-you-money RewriteRule articles/([a-zA-Z0-9_-]+)$ article.php?slug=$1 Someone told me I need to close it out with an [L] or something, but they weren't very clear. Can someone help me figure out what might be wrong with the above code which seems to be working fine? BTW, in my Dev environment, the above code is all I have in my .htaccess file, however in Production I will probably have other code - which I really don't understand - that does things like make sure my site starts with "www" and redirects for old pages that are dead. Maybe now is time for .htaccess/Mod_Rewite "housecleaning?! Thanks, Debbie Quote Link to comment https://forums.phpfreaks.com/topic/254229-what-is-l-for/ Share on other sites More sharing options...
doubledee Posted January 9, 2012 Author Share Posted January 9, 2012 Anyone out there? Debbie Quote Link to comment https://forums.phpfreaks.com/topic/254229-what-is-l-for/#findComment-1305666 Share on other sites More sharing options...
kicken Posted January 13, 2012 Share Posted January 13, 2012 http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule last|L Stop the rewriting process immediately and don't apply any more rules. Especially note caveats for per-directory and .htaccess context (see also the END flag). Rewrite rules can be chained together so something can be re-written multiple times. Using [L] will cause the process to stop after the rule is applied. There are many flags that can be set. The manual page I linked above explains all of them. Quote Link to comment https://forums.phpfreaks.com/topic/254229-what-is-l-for/#findComment-1307116 Share on other sites More sharing options...
doubledee Posted January 13, 2012 Author Share Posted January 13, 2012 http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule last|L Stop the rewriting process immediately and don't apply any more rules. Especially note caveats for per-directory and .htaccess context (see also the END flag). Rewrite rules can be chained together so something can be re-written multiple times. Using [L] will cause the process to stop after the rule is applied. There are many flags that can be set. The manual page I linked above explains all of them. How does my .htaccess file look?? #---------------------------------------------------------- #Eliminate index.php. RewriteEngine on RewriteCond %{THE_REQUEST} "GET /index.php HTTP/1.1" RewriteRule index\.php http://www.mywebsite.com/ [R=301,L] #---------------------------------------------------------- #Redirect all non-www calls to www. RewriteEngine on RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule .? http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] #---------------------------------------------------------- # Build Date: 2012-01-03 2:20pm RewriteEngine on #PRETTY: articles/postage-meters-can-save-you-money #UGLY: article.php?slug=postage-meters-can-save-you-money #RewriteRule articles/([a-zA-Z0-9_-]+)$ article.php?slug=$1 RewriteRule articles/([a-zA-Z0-9_-]+)$ articles/article.php?slug=$1 #---------------------------------------------------------- #Clean up Dead Links in Google. Redirect 301 /browse/articles/3 http://www.mysite.com/article_index.php Thanks, Debbie Quote Link to comment https://forums.phpfreaks.com/topic/254229-what-is-l-for/#findComment-1307118 Share on other sites More sharing options...
dreamwest Posted January 19, 2012 Share Posted January 19, 2012 RewriteRule ^articles/([a-zA-Z0-9_-]+)$ articles/article.php?slug=$1 [L,QSA,NC] Quote Link to comment https://forums.phpfreaks.com/topic/254229-what-is-l-for/#findComment-1309181 Share on other sites More sharing options...
doubledee Posted January 20, 2012 Author Share Posted January 20, 2012 RewriteRule ^articles/([a-zA-Z0-9_-]+)$ articles/article.php?slug=$1 [L,QSA,NC] What does that do?? Debbie Quote Link to comment https://forums.phpfreaks.com/topic/254229-what-is-l-for/#findComment-1309469 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.