Reputation: 3282
I have a URL (Example.com/blog/) and blog
is a directory in my website root. blog
contains an index.php file that generates a page based on the query string of ?url=[some url]
for example let's say example.com/blog/?url='hello-world' is a valid query string where information can be generated. I want that URL to be example.com/blog/hello-world
Currently, I have a global .htaccess file that removes all extensions. Inside my blog directory is another .htaccess file. It has my attempt at making the URL change to the friendly URL:
RewriteEngine on
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(blog)/(.*)$ blog/index.php?url=$2
Unfortunately, this isn't working. How can I solve this problem so the friendly URL displays?
Upvotes: 0
Views: 480
Reputation: 7476
Try this it like this,
RewriteEngine on
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /blog/?url=$1 [QSA,NC,L]
Upvotes: 2