I currently redirect URL's using the code below within a .htaccess
file.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^news/(.*)$ /news/page.php?ref=$1
This works perfectly and enables me to run a script within page.php
to retrieve the correct article. The issue I have is that /news/
gets redirected to page.php
, even though no article is specified within the url. How can I modify this code to avoid this.
Currently as a quick fix I have put a condition at the beginning of the page.php
file that checks if ref
is set and if not then redirect to /news/index.php
. This works because I have specified a file, index.php
. I would like the url /news/
to resolve without index.php
having to be specified.