Jay Jay
Jay Jay

Reputation: 11

.htaccess doesnt take the rewrite rule

i have a problem with the htaccess file from a system which i bought.

The Original File looks like this:

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule> 

My modified version looks like this:

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /

RewriteRule ^city-([^/]+).html searcharea?city=$1&sd=ls [L]
RewriteRule ^city-normal-([^/]+).html searcharea?city=$1&sd=pb [L]
RewriteRule ^city-special-([^/]+).html searcharea?city=$1&sd=oeb [L]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule> 

The Systems Base Home Link looks like this:

http://www.url.de/store/home

and my .htaccess is completely ignored, i wonder why? i want to include a seo linking to the system and reffer its url to the function but it doesnt work with this htaccess.

i have this htaccess rules in my other htaccess file from another system and there it works perfectly.

edit:

the rules from original file work, just my rules are ignored. mod_rewrite is enabled

Structure of my dirs:

/
/.htaccess
/index.php -> uses yiiframework to build pages
/core
/core/css
/core/js

Upvotes: 1

Views: 64

Answers (2)

Amit Verma
Amit Verma

Reputation: 41219

This is because your orignal htaccess rules are conflicting with the new rules and they rewrite all non existent requests to index.php. To fix this, you need to reorder your rules .

Try :

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /

RewriteRule ^city-([^/]+).html searcharea?city=$1&sd=ls [L]
RewriteRule ^city-normal-([^/]+).html searcharea?city=$1&sd=pb [L]
RewriteRule ^city-special-([^/]+).html searcharea?city=$1&sd=oeb [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


</IfModule> 

Upvotes: 1

Jakub Judas
Jakub Judas

Reputation: 787

Make sure that mod_rewrite is enabled in apache on your server.

Upvotes: 0

Related Questions