Answer the question
In order to leave comments, you need to log in
Redirect from old URLs to converted CNCs?
I decided to take care of more or less readable urls.
The idea is this:
Было: Стало:
ex.com/maker.php?id=mois ex.com/maker/mois
ex.com/condition.php?id=1 ex.com/condition/1
ex.com/expample.php ex.com/expample
RewriteEngine on
RewriteRule ^maker/([a-z]+)/? maker.php?id=$1 [L]
RewriteRule ^maker/([a-z]+)? maker.php?id=$1 [L]
RewriteRule ^condition/([0-9]+)/? condition.php?id=$1 [L]
RewriteRule ^condition/([0-9]+)? condition.php?id=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)/$ $1.php
RewriteCond %{QUERY_STRING} ^id=([a-z]+)$ [NC]
RewriteCond %{QUERY_STRING} !htaccess=Y
RewriteRule ^(.*) /maker/%1? [R=301,L]
Answer the question
In order to leave comments, you need to log in
# 301 --- ex.com/maker.php?id=1 => ex.com/maker/1
RewriteCond %{QUERY_STRING} (^|&)id\=1($|&)
RewriteRule ^ex\.com/maker\.php$ http://ex.com/maker/1? [L,R=301]
# 301 --- ex.com/condition.php?id=1 => ex.com/condition/1
RewriteCond %{QUERY_STRING} (^|&)id\=1($|&)
RewriteRule ^ex\.com/condition\.php$ http://ex.com/condition/1? [L,R=301]
# 301 --- ex.com/expample.php => ex.com/expample
RewriteRule ^ex\.com/expample\.php$ http://ex.com/expample? [L,R=301]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question