Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

htaccess question - redirecting *most* of a site

need to preserve access to a script in a local subdirectory

3:25 pm on Nov 10, 2009 (gmt 0)

Junior Member

5+ Year Member

joined:Aug 27, 2008
posts: 65
votes: 0

I'm using htaccess to redirect pages from an old site to a new site in the following fashion:

redirect 301 /states/ http://www.example.com/states/

I'm redirecting the home page of site #1 to an interior page in site #2:

redirect 301 / http://www.example.com/somepage/

There's no extension on the home page URL on either site because both use URL rewriting.

What I'm trying to do is preserve access to a script that lives in the /actions/ subdirectory of the old site - call it "/actions/somescript.php". For some reason I can't use 301 redirects on that directory (e.g. "redirect 301 /actions/ http://www.example.com/actions/"), even though redirects work fine for the "phantom" directories (like /states/) that are created through the URL rewriting.

Any suggestions?/


3:57 pm on Nov 10, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
votes: 0

1) Use mod_rewrite instead of mod_alias, and use a RewriteCond to exclude URL-paths that you don't want redirected.

2) Check to see if MultiViews are enabled. If you don't use them, then disable them (See core "Options" directive.)

3) Check for a ScriptAlias directive in the server config files which refers to the script; This may preempt your Redirect for the script.