Reputation: 155
I'm trying to create some rules using .htaccess
:
i would like to do:
blog/
[specific-page-title] : should be a mask of src/components/blog/index.php
./index.php
./index.php
The .htaccess
file content is:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# RULES FOR BLOG
RewriteRule blog/(.+)$ ./src/components/blog/index.php?url=$1 [L,QSA,NC]
# RULES FOR LANDING PAGE
RewriteRule ([a-z\-_0-9]+)/([^/.]+)$ index.php?module=$1&url=$2 [QSA,NC]
RewriteRule ([^/.]+)$ index.php?url=$1 [QSA,NC]
The problem is
Always it's redirect to ./index.php
- i can't access blog.
How i can make the rules not be overwriten?
Upvotes: 1
Views: 16
Reputation: 12017
You're missing the ^
start anchor on your rules so they match URLs that they shouldn't:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# RULES FOR BLOG
RewriteRule ^blog/(.+)$ ./src/components/blog/index.php?url=$1 [L,QSA,NC]
# RULES FOR LANDING PAGE
RewriteRule ^([a-z\-_0-9]+)/([^/.]+)$ index.php?module=$1&url=$2 [QSA,NC]
RewriteRule ^([^/.]+)$ index.php?url=$1 [QSA,NC]
Upvotes: 1