doufubu2518
doufubu2518
2018-06-22 10:16

.htaccess重写规则Case inSensitive / Ignore case in urls

已采纳

I want to rewrite my URL for URL incase sensivity i.e. to convert url tolowercase

(eg. www.MywebsIte.Com/Abc should be redirected to www.mywebsitename.com/abc)

I have found may suggestion but all keep on giving me server 500 error refer code below:

<IfModule mod_rewrite.c>

  RewriteEngine on
  RewriteCond %{HTTP_HOST} !^www\.
  RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
  RewriteCond %{HTTPS} off 
  RewriteCond %{HTTPS_HOST} !^www.mywebsitename.com$ [NC]
  RewriteRule ^(.*)$ https://www.mywebsitename.com/$1 [L,R=301]

  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

The above code works perfectly fine. Need to add code/rule for URL case insensitive.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

相关推荐