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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.