Apache 正在重写没有查询字符串的url
具有以下类型的查询字符串的任何urlApache 正在重写没有查询字符串的url,apache,.htaccess,Apache,.htaccess,具有以下类型的查询字符串的任何url www.example.com/categories/type1?var1=abc&var2=def 正在重写,但完全没有查询字符串部分。i、 e www.example.com/categories/type1 我正在ubuntu 12 LAMP stack中的apache2服务器上工作。我的apache.conf文件 <Directory /var/www/html> Options Indexes FollowSymLinks
www.example.com/categories/type1?var1=abc&var2=def
正在重写,但完全没有查询字符串部分。i、 e
www.example.com/categories/type1
我正在ubuntu 12 LAMP stack中的apache2服务器上工作。我的apache.conf文件
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.php
AddType application/x-httpd .php
Order allow,deny
allow from all
</Directory>
有人能告诉我是什么导致了这种行为吗?您在浏览器中输入了什么URL,您如何知道查询字符串正在被删除?因此,当我输入www.example.com/categories/type1?var1=abc&var2=def时,它会立即在地址栏中更改为www.example.com/categories/type1。但是,$\u SERVER['REQUEST\u URI']显示“categories/type1?var1=abc&var2=def”。您的任何规则都没有执行任何重定向。代码可以这样做吗?
# 1 ---- Establish a custom 404 File not Found page ----
ErrorDocument 404 /filenotfound.php
# 2 ---- Prevent directory file listing in all of your folders ----
IndexIgnore *
RewriteEngine On
RewriteRule ^product1/([^/]*)$ /test_JSON.php?productId=$1
RewriteRule ^api/follow/([^/]*)/([^/]*)$ /follow.php?Name=$1&user=$2
RewriteRule ^category1/([^/]*)$ /$1.php [L]
RewriteRule ^ajax-product-collection/([^/]*)$ /ajax-product-collection.php/$1
RewriteRule ^categories/(.*)$ /ajax-product-base1.php [L]