1

这是重写规则在 .htaccess 中不起作用:

RewriteCond %{REQUEST_URI} ^/magento/resultados-busqueda/ 
RewriteRule resultados-busqueda/(.*) /magento/index.php/catalogsearch/result/$1 [L,QSA,NC]

如果我添加 [R] 标志,它工作正常,但没有 [R] 不起作用。

请帮忙!!

对不起我的英语不好。

谢谢!

4

3 回答 3

6

事实证明,新的 Apache 版本发生了一些变化,如果您使用的是 apache 2.4,我建议您更改etc/apache2/apache2.conf文件(您需要 root 权限),如下所示:

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

然后重启apache。

sudo service apache2 restart

有用 ;)

于 2014-09-24T22:35:55.967 回答
1

在您的以下 .htaccess 片段中使用$DOCUMENT_ROOT/magento/.htaccess

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /magento

RewriteRule ^resultados-busqueda/([^/]+)/?$ /magento/index.php/catalogsearch/result/?q=$1 [QSA,P,NC]
于 2013-02-08T10:35:41.430 回答
0

URI 域/magento/resultados-busqueda/pantalones 并显示错误 404。这是我的 .htaccess:

<IfModule mod_rewrite.c>

Options +FollowSymLinks -MultiViews
RewriteEngine On

RewriteBase /magento

RewriteRule ^api/rest api.php?type=rest [QSA,L]

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
RewriteRule .* - [L,R=405]

RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^resultados-busqueda/(.*)$ /magento/index.php/catalogsearch/result/?q=$1 [L,NC]

RewriteRule .* index.php [L]

于 2013-02-11T14:29:30.053 回答