Jump to content

Mod Rewrite


Recommended Posts

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]

Link to comment
https://forums.phpfreaks.com/topic/239464-mod-rewrite/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/239464-mod-rewrite/#findComment-1230509
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.