Welcome to WebmasterWorld Guest from 54.211.17.91

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

htaccess redirect question

redirect entire directory except one file

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

5+ Year Member



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.
10:45 pm on Nov 6, 2013 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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.
10:54 pm on Nov 6, 2013 (gmt 0)

5+ Year Member



does that L flag stop any rules from running or just the next rewrite rule? tx.
12:26 am on Nov 7, 2013 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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.
1:13 am on Nov 7, 2013 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



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.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month