简体   繁体   中英

.htaccess redirection with query string on url

I have a website www.example.com/blog/abc. I need it to redirect to www.example.com/blog/a.php?a=abc

Below is my .htaccess file

RewriteEngine On
RewriteBase /
RewriteRule ^blog/(.*)$ blog/a.php?a=$1 [R=301,L]

What am i doing wrong ?

Try:

RewriteRule ^blog/(.*)/?$ blog/a.php?a=$1

Instead of:

RewriteRule ^blog/(.*)$ blog/a.php?a=$1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM