Home

Tuesday, September 18, 2012

htaccess rewrite rule to remove a subfolder from a URL


This will assume you have http://domain.com/sub as where the content you want to load is.  And the resulting URL to only show http://domain.com butstill load the content in in the /sub folder.

This could be modified many ways to suit the needs for the application at hand.

RewriteEngine On
RewriteRule ^$ sub/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ sub/$1

No comments:

Post a Comment

rathoddhirendra.blogspot.com-Google pagerank and Worth