简体   繁体   中英

How to remove only one url .html in .htaccess

I have a url similar to below

www.test.com/products.html

I want this to work when someone type www.test.com/products (without .html)

I only want to do this this file and the rest has to work as normal. I know how to do this for all html files as below and works ok.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]

I have not much idea about unix stuff. Can someone help ? only the www.test.com/products should call the www.test.com/products.html.

Thanks

This should work:

RewriteEngine On
RewriteRule ^products/?$ products.html

Add any flags as you see fit.

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