简体   繁体   中英

Rewrite /(index.php) to /home/(index.php)

I want to rewrite www.example.com or www.example.com/ or www.example.com/index.php to /home/ .

I tried this but I'm getting Internal Server Error :

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

What am I doing wrong?

Try below rule,

RewriteEngine On
RewriteCond %{REQUEST_URI} ^(/|/index.php)$
RewriteRule ^ home/ [L]

You can use this rule as your very first rule in site root .htaccess:

RewriteEngine On

RewriteEngine ^/?(index\.php)?$ /home/ [L,NC]

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