Reputation: 3
At present, the .htaccess file will mask dynamic links with static links e.g. www.example.com/news/news.php?article=foo-bar will read as www.example.com/news/foo-bar/.
However, if I wanted to open www.example.com/news/ instead of www.example.com/news/index.php, it still redirects it to www.example.com/news/news.php e.g. adding ?article=index on the end.
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^news/(.*)$ /news/news.php?article=$1 [L,QSA,NC]
Any suggestions on how to fix this?
Upvotes: 0
Views: 73
Reputation: 112
If I correctly understand your problem,
your REGEX should be ^news/(.+)$
instead of ^news/(.*)$
.
+
means one or more
*
means zero or more
Upvotes: 1