A
A
Aleks3052015-12-24 23:26:38
Apache HTTP Server
Aleks305, 2015-12-24 23:26:38

How to make apache rewrite for / only?

Hello everyone, friends.
Tell me, please, is it possible to do only such a rewrite on apache, which would translate only a link like: test.com to www.test.com , and for all other links with a direct call, such as test.com/abrakadabra , did not rewrite.
I tried to do this:
RewriteEngine On
RewriteCond %{HTTP_HOST} test.com$ [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ www.test.com [R=301,L]
But it redirects to all links, not just an empty URI.
Thank you!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question