user947462
user947462

Reputation: 949

URL Rewriting - hide part of url

I have an url like this one:

http://xxxx.com/cms/
....
http://xxxx.com/cms/about-us/concept/
http://xxxx.com/cms/something/

What i want is hide the cms folder of the url.

So when i type in url http://xxxx.com/ I should be redirected to http://xxxx.com/cms/ but the cms should not be visible.

Any help?

Upvotes: 0

Views: 1682

Answers (2)

Sebastian
Sebastian

Reputation: 21

.htaccess file

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www.)?example.com$

RewriteCond %{REQUEST_URI} !^/cms/

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /cms/$1

RewriteCond %{HTTP_HOST} ^(www.)?example.com$

RewriteRule ^(/)?$ cms/index.php [L]

Upvotes: 2

jebentier
jebentier

Reputation: 151

The best way to do this is by changing the DocumentRoot in your apache config. In the config file just tack on "/cms" to the DocumentRoot= value and restart apache.

Upvotes: 0

Related Questions