简体   繁体   中英

Rewriterule htaccess

I am still new to .htaccess and I tried some sample RewriteRule which ends with a 500 internal server error.. I tried to check out some documentations out there, without having my answer. I want to change my url : www.mywebsite.com/products/apron/?item=B-200 to something like www.mywebsite.com/products/apron/B-200

So I created a .htaccess file with this in it :

RewriteEngine On
RewriteBase /

RewriteRule ^products/apron/([0-9a-zA-Z]+)/$ /products/apron/?item=$1 [NC, L]

At the end, I just get a white page with a 500 internal server error.. I tried so many changes in my RewriteRule but always ended up with this error..

Have it this way:

Options -MultiViews
RewriteEngine On
RewriteBase /

RewriteRule ^products/apron/([0-9a-zA-Z]+)/$ products/apron/?item=$1 [NC,L,QSA]
  • No space before L flag to avoid 500 error.
  • Options -MultiViews is used to avoid content negotiation conflicting with mod_rewrite

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