简体   繁体   中英

Remove sub directory from URL?

I'd like to rewrite:

http://www.example.com/item.html/category/something/something2

To :

http://www.example.com/item/something/something2

Thus getting rid of "category" and ".html"

I have tried:

#rewrite to remove "category" and ".html"
RewriteEngine On 
RewriteCond %{REQUEST_URI} !^item.html/category/
RewriteRule ^item/(.*)$ /item/category/$1 [QSA,L]

Do you need the RewriteCond, just do the rewrite like so:

RewriteEngine On 
RewriteRule ^item.html/category/(.*)$ /item/$1 [QSA,L]

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