homepage Welcome to WebmasterWorld Guest from 54.197.111.87
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
htaccess redirect question
redirect entire directory except one file
santapaws




msg:4621548
 12:01 pm on Nov 6, 2013 (gmt 0)

Hi
Just trying to figure how to write a redirect 410 for an entire directory except for a single file that is to be 301'd to a new location.

tx.

 

phranque




msg:4621691
 10:45 pm on Nov 6, 2013 (gmt 0)

first, a RewriteRule with the [R=301,L] flag to handle the more specific file redirect.
then, a separate RewriteRule using the [G] flag to provide the 410 status code for the more general directory case.

santapaws




msg:4621694
 10:54 pm on Nov 6, 2013 (gmt 0)

does that L flag stop any rules from running or just the next rewrite rule? tx.

phranque




msg:4621715
 12:26 am on Nov 7, 2013 (gmt 0)

http://httpd.apache.org/docs/current/rewrite/flags.html#flag_l
The [L] flag causes mod_rewrite to stop processing the rule set.

it's more complicated than that, so you should really read and understand the entire section.

lucy24




msg:4621720
 1:13 am on Nov 7, 2013 (gmt 0)

does that L flag stop any rules from running or just the next rewrite rule? tx.

Each module is an island. So even if mod_rewrite has already handed out a decisive 403, all the other mods still have to run.

Ordinarily you list rules in order of severity, so a 410 would come before a 301. But sometimes-- like here-- it's more practical to put some rules out of sequence.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved