Change url via . HTACCES

Asked

Viewed 426 times

0

Sehores, good afternoon, sir. I need to change my homepage to a subfolder. I added the following code to my file .htaccess, but only worked for url without www, ex: dominio.com.br , redirects to dominio.com.br/webstore (correct redirect). If typed www.dominio.com.br , redirect does not work. What I edited was:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^dominio.com.br$ [NC,OR]
RewriteCond %{HTTP_HOST} ^dominio.com.br$
RewriteCond %{REQUEST_URI} !webstore/
RewriteRule (.*) /webstore/$1 [L]

What should I do for the url containing www also be redirected?

1 answer

0

Hello, it’s simple, just put www being optional on condition. Example:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?dominio.com.br$
RewriteCond %{REQUEST_URI} !webstore/
RewriteRule (.*) /webstore/$1 [L]
  • It didn’t work. If I do this, go back to the beginning. What I did and it worked was: Rewritecond %{HTTP_HOST} domino.com.br$ [NC,OR] Rewritecond %{HTTP_HOST} www.dominio.$

  • I just don’t know if it’s the right way to go.

  • I made the change, it was really incorrect, see if now it will work, anything we can do! rsr

Browser other questions tagged

You are not signed in. Login or sign up in order to post.