M
M
Maxim2014-01-05 02:01:44
Apache HTTP Server
Maxim, 2014-01-05 02:01:44

How to correctly write a redirect in .htaccess mod_rewrite?

Actually, I am not very familiar with mod_rewrite, such a task:
You need to change the page addresses www.domain.com/index.php?mod=smth to www.domain.com/smth/
I read the manuals, I try

RewriteEngine on
RewriteRule ^/([a-z]+)$ index.php?mod=$1 [R=301,L]

Doesn't
work Tried with query string
RewriteCond %{QUERY_STRING} ^mod=(.*)$    [NC]
RewriteRule ^/$? /%1      [NC,L,R=301]

Gives a 500 error
Tell me where to dig?

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