I
I
Ilya T.2018-07-25 22:58:55
Apache HTTP Server
Ilya T., 2018-07-25 22:58:55

How to write a redirect in htaccess?

Please teach me how to write the correct redirect.
There is a working .htaccess

RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]

You need to make some simple redirects like
site.com/chtotam -> site.com/fignya/chtotam
Everything I write before the last rewrite, even with the [L] flag, leads to an infinite loop.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2018-07-26
@Insaned

RewriteEngine on

RewriteRule ^chtotam$ /fignya/chtotam [R=301,L]

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question