mod-rewrite: what's wrong with this simple rewrite to redirect to a subdirectory?

Posted by Tom Auger on Server Fault See other posts from Server Fault or by Tom Auger
Published on 2011-01-12T15:05:10Z Indexed on 2011/01/12 15:55 UTC
Read the original article Hit count: 270

the root directory http: // www .mydomain .com (SF won't let me post hyperlinks - rep is too low) has a catchall index.php page in it, and an .htaccess file. Within this root directoy I have a wordpress/ directory which contains (suprise surprise) a wordpress installation.

My goal is that when the user types in http: // www .mydomain .com they are instead taken to http: // www .mydomain .com/wordpress

Here is my rewrite rule:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/wordpress
RewriteRule ^/(.*)$ http://%{SERVER_NAME}/wordpress/$1 [L]

At the moment it appears to do nothing - it still loads index.php within the root directory.

What should my rewrite rule be (I'm assuming the one I'm using is wrong)?

© Server Fault or respective owner

Related posts about apache

Related posts about mod-rewrite