URL rewrite not working
Posted: 26. January 2015 21:39
Hi there,
I'm currently running a project outside of the normal htdocs folder. I have a host file setup so that I can run things from a dev folder. So I can visit a URL such as:
My .htaccess:
I'm currently running a project outside of the normal htdocs folder. I have a host file setup so that I can run things from a dev folder. So I can visit a URL such as:
- Code: Select all
myproject.local
My .htaccess:
- Code: Select all
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^blog/([a-zA-Z0-9-/]+)/preview$ /blog/post.php?s=$1&preview=all [L]
RewriteRule ^blog/([a-zA-Z0-9-/]+)$ /blog/post.php?s=$1 [L]
RewriteRule ^category/([a-zA-Z0-9-/]+)$ /blog/archive.php?cat=$1 [L]
RewriteRule ^tag/([a-zA-Z0-9-/]+)$ /blog/archive.php?tag=$1 [L]
# Redirect to PHP if it exists.
# e.g. example.com/foo will display the contents of example.com/foo.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ $1.php [L,QSA]
</IfModule>