访问问题-从漂亮的url重定向到php版本


Htaccess issues - Redirecting from pretty url to php version

我不是一个新的开发人员,已经使用.htaccess多年了,但今天我完全被卡住了,不知道发生了什么。下面是我的完整htaccess文件:

Options All -Indexes
ReWriteEngine On
RewriteRule ^page/([a-zA-Z0-9_-]+)$ page.php?pageurl=$1
RewriteRule ^([a-zA-Z0-9_-]+)$ category.php?categoryurl=$1
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([0-9]+)-([a-zA-Z0-9_-]+)$ product.php?category=$1&subcategory=$2&productid=$3&producturl=$4

RewriteCond %{HTTP_HOST} www.website'.com$ [NC]
RewriteRule ^(.*)$ http://website.com/$1 [R=301,L]

website.com/category应该会把我带到类别页面,但由于某种原因,url发生了更改,就好像htaccess正在反向工作一样,我会被发送到website.com/catalgory.php?categoryurl=类别。

这与其他产品完全相同,我的产品页面应该是website.com/category/subcategory/123-producturl,但它也重定向:

website.com/product.php/category/123-producturl?category=category&subcategory=子类别&productived=123&producturl=producturl

有人知道为什么会这样吗?

试试这个,你还没有在HTACCESS中添加结束行的标志。

Options All -Indexes
ReWriteEngine On
RewriteRule ^page/([a-zA-Z0-9_-]+)$ page.php?pageurl=$1 [L]
RewriteRule ^([a-zA-Z0-9_-]+)$ category.php?categoryurl=$1 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([0-9]+)-([a-zA-Z0-9_-]+)$ product.php?category=$1&subcategory=$2&productid=$3&producturl=$4 [L]

RewriteCond %{HTTP_HOST} www.website'.com$ [NC]
RewriteRule ^(.*)$ http://website.com/$1 [R=301,L]