Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Making Multiple .htaccess files


lucy24 - 9:05 pm on Sep 13, 2012 (gmt 0)


I am trying to switch all Redirect 301s

If you've got a whole lot of them, paste them into a text editor that does Regular Expressions and run the following (three separate changes, use the ones you need):

# change . to \.

^(Redirect \d\d\d \S+?[^\\])\.
REPLACE WITH
$1\\.

# now change Redirect to Rewrite

^Redirect(?:Match)? 301 /(.+)
REPLACE WITH
RewriteRule $1 [R=301,L]

# and

^Redirect(?:Match)? 410 /(.+)
REPLACE WITH
RewriteRule $1 - [G,L]


Thread source:: http://www.webmasterworld.com/apache/4437176.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com