R
R
RipWay2015-06-20 11:12:31
htaccess
RipWay, 2015-06-20 11:12:31

How to correctly formulate a regular expression for htaccess?

Hello. Please tell me how to write a rule for htaccess so that when you go to such an address news.php?xxxx there is a 301 redirect to just xxxx.html

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri, 2015-06-20
@gLibc

RewriteCond %{QUERY_STRING} ^news.php?(.*)$ [NC]
RewriteRule ^(.*)$ %1.html [L,R=301]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question