简体   繁体   中英

Mod_Rewrite rule from htaccess

I'm new at apache rewrite rules and I'm trying to make a rule that do this, from:

http://anydomain/anyfolder/anyfile.Extension?anyquery

To:

http://anydomain/anyfolder-anyfileWithoutExtension?anyquery

What I did was:

RewriteEngine on
RewriteRule ([0-9]+)-([^/]+)?$ $1/$2 [NC,L,QSA]

But it doesnt work as it should Any ideas?

If you want to redirect

To:

try the following rule in root/.htaccess:

RewriteEngine on

RewriteRule ^/?(.+)/(.+)\..+$ /$1/$1 [L,R]

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