Remove exact string from end of url apache htaccess rewriterule

心已入冬 提交于 2021-01-29 04:08:34

问题


I have all my URLs like this example: http://domain.com/="%7b%7bstore

I would like to create a RewriteRule to remove the trailing ="%7b%7bstore from the url.

The string is always at the end. The rule has to leave any other query string, url part untouched.

I figured that %7b translates to {.

I got this far with the rule, but can't figure out the rest:

RewriteRule ^/?(.*)store$ /$1 [L,R=301]

Could anybody help? Thank you!


回答1:


You can use this rule as your first rule in root .htaccess:

RewriteEngine On

RewriteRule ^(.*?)="\{\{store(.*)$ /$1$2 [L,R=301]


来源:https://stackoverflow.com/questions/24268906/remove-exact-string-from-end-of-url-apache-htaccess-rewriterule

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!