put this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^/?$ /wp/index.php [L]
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^/?$ /index.html [L]
Вопрос
I wonder how to redirect links with .htaccess.
One domain links http://domain.com
to index.html, and another http://www.domain.com
to /wp/index.php.
When someone types www.my-domain.com
in the browser. I want that domain with www. to redirect to one one file, for example /unique/one.php. And when someone types my-domain.com
without www., that should redirect to another file in my directory, for instance /another/index.php.
Any solutions for this problem?
Решение
put this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^/?$ /wp/index.php [L]
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^/?$ /index.html [L]