Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 重写规则访问_.htaccess_Mod Rewrite - Fatal编程技术网

.htaccess 重写规则访问

.htaccess 重写规则访问,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我仍然是.htaccess的新手,我尝试了一些重写规则的示例,最后出现了一个500内部服务器错误。。我试图在没有答案的情况下查看一些文档。我想将我的url:www.mywebsite.com/products/aperror/?item=B-200更改为类似于www.mywebsite.com/products/aperror/B-200的内容 因此,我创建了一个.htaccess文件,其中包含以下内容: RewriteEngine On RewriteBase / RewriteRule ^

我仍然是.htaccess的新手,我尝试了一些重写规则的示例,最后出现了一个500内部服务器错误。。我试图在没有答案的情况下查看一些文档。我想将我的url:www.mywebsite.com/products/aperror/?item=B-200更改为类似于www.mywebsite.com/products/aperror/B-200的内容

因此,我创建了一个.htaccess文件,其中包含以下内容:

RewriteEngine On
RewriteBase /

RewriteRule ^products/apron/([0-9a-zA-Z]+)/$ /products/apron/?item=$1 [NC, L]
最后,我得到了一个包含500个内部服务器错误的白色页面。。我在重写规则中尝试了很多更改,但最终总是出现此错误。

按此方式执行:

Options -MultiViews
RewriteEngine On
RewriteBase /

RewriteRule ^products/apron/([0-9a-zA-Z]+)/$ products/apron/?item=$1 [NC,L,QSA]
  • L
    标志前没有空格,以避免500错误
  • 选项-多视图
    用于避免内容协商与
    mod_rewrite