user6790913
user6790913

Reputation:

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?

Upvotes: 1

Views: 511

Answers (2)

Abhishek Gurjar
Abhishek Gurjar

Reputation: 7476

Try below rule,

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

Upvotes: 1

anubhava
anubhava

Reputation: 785156

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

RewriteEngine On

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

Upvotes: 0

Related Questions