我无法获得.htaccess重写规则来与我的Prestashop网站一起使用 [英] I cannot get .htaccess rewrite rule to work with my Prestashop site
本文介绍了我无法获得.htaccess重写规则来与我的Prestashop网站一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好的,我使用自动生成器在.htaccess文件中为我的prestashop网站生成了一个自定义URL,但是它不起作用。有任何想法吗?
Okay, I used an automated generator to generate a custom URL for my prestashop site in the .htaccess file, but it does not work. Any ideas?
原始网址是:
http://www.example.com/de/suche?controller=search&orderby=position&orderway=desc&search_query=mutter&submit_search=OK
重写后的网址应为:
http://www.example.com/search/position/desc/mutter/OK.html
和.htaccess文件中的重写规则是:
and the rewrite rule I have in the .htaccess file is:
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)\.html$ /de/suche?controller=$1&orderby=$2&orderway=$3&search_query=$4&submit_search=$5 [L]
推荐答案
您应删除 [L]
标志。
<IfModule mod_rewrite.c>
RewriteEngine on
#Domain: test.example.com
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api$ api/ [L]
RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]
# Images
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
# [...]
# You need to put your condition here without the [L] flag
# And before the Dispatcher
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)\.html$ /de/suche?controller=$1&orderby=$2&orderway=$3&search_query=$4&submit_search=$5
# Your URL is then rewritten to Prestashop standard format
# and will be sent to the following Dispatcher.
# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
</IfModule>
这篇关于我无法获得.htaccess重写规则来与我的Prestashop网站一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文