Jump to content

Recommended Posts

Righto, I have this in my .htaccess file:

# BEGIN NoExtensions
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME}.html -f
    RewriteRule (.*) $1.html [L]
    RewriteCond %{REQUEST_FILENAME}.php -f
    RewriteRule (.*) $1.php
# END NoExtensions

Which works fine for URLs like mysite.com/contact, mysite.com/about, but not for URLs like mysite.com/contact/, mysite.com/about/ with a trailing slash. I'm really terrible with regular expressions, and I fail when trying to get it to recognize the trailing slash.

 

In doing so I realized by adding a trailing slash I could potentially block all my subdirectories from being accessed, so how can I whitelist the file (URLs) I want to rewrite?

Link to comment
https://forums.phpfreaks.com/topic/141480-no-extensions-htaccess-trailing-slash/
Share on other sites

  • 2 years later...

Hello

 

I have been looking for the very same solution and after trying your amendment in my htaccess file I got the 500 error. My logs state this:

 

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

 

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.