Twistedweb123 Posted June 15, 2011 Share Posted June 15, 2011 Hi, so this is my issue. I have written this is htaccess to redirect all my xxx.html to /xxx on my site. However, I know this effects directories. If i visit mydomain.com/admin/ i get a 404 error, but if i visit mydomain.com/admin/index.php it is fine. This is fine, but I have an issue with my blog directory (it is running wordpress). How do I write a mod rewrite query to not effect the blog directory, as mydomain.com/blog/index.php redirects to mydomain.com/blog/ ... this then looks for blog.php which doesnt exist. I'm open to all suggestions. Here is my current code: RewriteEngine on RewriteRule ^([^/\.]+)/?$ $1.php [L] Quote Link to comment https://forums.phpfreaks.com/topic/239464-mod-rewrite/ Share on other sites More sharing options...
cags Posted June 16, 2011 Share Posted June 16, 2011 If you just want to skip that folder you can add a RewriteCond to ignore it, something like... RewriteEngine on RewrteCond %{REQUEST_URI} ! ^/blog RewriteRule ^([^/\.]+)/?$ $1.php [L] P.S. I can't remember off hand if that forward slash is required before blog or not, it basically says, only follow this RewriteRule if the requested address doesn't begin with blog. Quote Link to comment https://forums.phpfreaks.com/topic/239464-mod-rewrite/#findComment-1230509 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.