Forum Moderators: phranque
------
RewriteCond %{REQUEST_URI} ^$
RewriteCond %{HTTP_HOST} ^domain.com/Directory/$
RewriteRule ^$ [domain.com...] [L,R=301]
HTTP_HOST variable holds exactly the domain name, and not any server filepath information. You should be redirecting the other way, from "index" to "/". Search engines prefer the shorter of the two URLs.
Redirect to strip the index filename off the URL, otherwise you might end up with a problem like this: [webmasterworld.com...]
Ensure you add
DirectoryIndex index.php so that requests for "/" are internally rewritten to the correct index file in the server.
Let's put it this way, Do you search at www.google.com/, or at www.google.com/index.py?
However, the correct code for the problem as stated, for use in example.com/.htaccess, would be:
RewriteRule ^Directory/$ http://www.example.com/Directory/index.php [L,R=301]
The RewriteCond testing %{HTTP_HOST} isn't needed unless you have multiple subdomains or domains, and only want to apply this redirect to some of them.
Jim