Simon
Simon

Reputation: 199

.htaccess redirect + rewrite problems

I'm trying to redirect http://www.example.com/ to http://www.example.com/public/plebs/ using the htaccess file.

But my problem is that I don't want the url's to look like this: http://www.example.com/public/plebs/.example.php but like this: http://www.example.com/example.php

Let me now if you could help me, thanks.

Upvotes: 1

Views: 32

Answers (1)

Jon Lin
Jon Lin

Reputation: 143946

Try something like:

RewriteCond %{REQUEST_URI} !^/public/plebs
RewriteRule ^(.*)$ /public/plebs/$1 [L]

or

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/public/plebs/$1 -f [OR]
RewriteCond %{DOCUMENT_ROOT}/public/plebs/$1 -d
RewriteRule ^(.*)$ /public/plebs/$1 [L]

depending on how you've got your server setup.

Upvotes: 1

Related Questions