简体   繁体   中英

.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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM