Pregunta

I want to load contents of http://www.example.com/store/index whenever someone visits http://www.example.com/ without changing the URL. I tried the following URL and it doesn't work. Please help. Am I missing something very basic?

RewriteRule / /store/index [R=301,L]

¿Fue útil?

Solución

You can use this rule in your root .htaccess:

RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+store/index[?\s/] [NC]
RewriteRule ^ /? [R=301,L]

RewriteRule ^/?$ /store/index [L]
  • You need to match ^/?$ to make sure you're only rewriting home page
  • You must not use R flag to avoid URL changing in browser
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top