P
P
Pyzhik2014-10-30 11:39:54
htaccess
Pyzhik, 2014-10-30 11:39:54

How to make a redirect from the main page to a specific page using .htaccess?

Previously, I implemented a redirect from the main domain to the site page.
Everything worked, but now it began to write that the redirection is cyclic.
Please tell me what is wrong and why the script stopped working?

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site.ru
RewriteRule ^(.*)$ http://site.ru/campaign$1 [R=permanent,L]
RewriteCond %{HTTP_HOST} ^www.site.ru
RewriteRule ^(.*)$ http://site.ru/campaign$1 [R=permanent,L]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
ShamblerR, 2015-02-25
@ShamblerR

RewriteCond %{HTTP_HOST} ^site.ru$
RewriteCond %{REQUEST_URI} !^campaign.*/$
RewriteRule ^(.*)$ http://site.ru/campaign$1 [R=permanent,L]

Mde and you do not mind that the next time this rule {HTTP_HOST}
will be the same? and the rule will work again by adding another campaing to the existing line?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question