user2896120 user2896120 - 1 year ago 70
Apache Configuration Question

SEO friendly URL not working

I have a URL ( and

is a directory in my website root.
contains an index.php file that generates a page based on the query string of
?url=[some url]
for example let's say'hello-world' is a valid query string where information can be generated. I want that URL to be

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?

Answer Source

Try this it like this,

RewriteEngine on
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /blog/?url=$1 [QSA,NC,L]