开发者

How to remove a ? from a url with htaccess using 301 redirect

开发者 https://www.devze.com 2023-01-22 08:06 出处:网络
I need an htaccess 301 redirect for dynamic urls going from this url: http://www.example.com/index.php/?content/page1

I need an htaccess 301 redirect for dynamic urls going from this url:

http://www.example.com/index.php/?content/page1

to

http://www.example.com/content/page1

My current htaccess rule is:

RewriteBase /    
RewriteCond %{HTTP_HOST} !="" 
RewriteRule ^index.php(/.*)$ http://%{HTTP_HOST}$1 [R=301]

the p开发者_如何学Croblem is I get urls like this:

http://www.example.com/?content/page1

How can I remove that question mark (?) from the url. Also this is for about 20 different urls in this pattern. I would like the rule to work for all my urls needing to be 301 in this pattern.


End the target in a ?.

RewriteRule ^index.php(/.*)$ http://%{HTTP_HOST}$1? [R=301]
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号