majareta
majareta

Reputation: 63

htaccess rewrite rule not working with magento

This is the rewrite rule does not working in .htaccess:

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

If I add [R] flag, it's work fine, but without [R] does not work.

Please help!!

Sorry for my english.

Thank you!

Upvotes: 1

Views: 12397

Answers (3)

Marcelo Burkard
Marcelo Burkard

Reputation: 86

It turns out that the new Apache version has changed in some way, if you are using apache 2.4, I suggest you to change your etc/apache2/apache2.conf file (you'll need root permission) as follows:

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

Then restart apache.

sudo service apache2 restart

It works ;)

Upvotes: 6

anubhava
anubhava

Reputation: 786091

Use below .htaccess snippet in your $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]

Upvotes: 1

majareta
majareta

Reputation: 63

URI domain/magento/resultados-busqueda/pantalones and show error 404. This my .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]

Upvotes: 0

Related Questions