I have the following situations on my server:
/->
news->
.htaccess
index.php
post.php
...
And the following rules in my .htaccess:
RewriteRule ^(.*)/admin post.php?slug=$1&admin_mode=true [NC,QSA,L]
RewriteRule ^(.*)$ post.php?slug=$1 [NC,QSA,L]
Now I need my URLs to be the following:
If requested www.mydomain.com/news/ -> it should get the index.php file
If requested www.mydomain.com/friendly-title-of-my-article -> it should get the post.php file with the query string as indicated in my .htaccess.
Currently I get correctly the post.php with the query string, but when I go to www.mydomain.com/news/ , it's requesting the post.php file.
Please help. Thanks
Use this
#if query string is empty
RewriteCond %{QUERY_STRING} ^$
#match on / for root, or .index.php in request and send to query string version
RewriteRule ^(/|index.php)?$ /index.php?step=1 [R=301,L]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With