Skip to main content

.htaccess extentionless url rewrites breaking folder redirects?

Comments

2 comments

  • Jase Wolf
    [COLOR=rgb(3, 42, 70)]Right after some testing this is the culprit, had a bit of a feeling it was this as I was also having redirect issues just with the php rewriting I were using.
    # Rewrite files to extensionless urls RewriteRule ^([^/.]+)$ /$1.php [L] RewriteRule ^([^/.]+)$ /$1.html [L] RewriteRule ^([^/.]+)$ /$1.shtml [L] RewriteRule ^([^/.]+)$ /$1.htm [L]
    Using this code instead fixes it
    # Rewrite files to extensionless urls RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php [NC,L] RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^(.*)$ $1.html[NC,L] RewriteCond %{REQUEST_FILENAME}.htm -f RewriteRule ^(.*)$ $1.htm [NC,L] RewriteCond %{REQUEST_FILENAME}.shtml -f RewriteRule ^(.*)$ $1.shtml [NC,L]
    So WOOOHOOOOOOOOOOOOOOOO, four forums I posted this in, been trying to work this out for ages and finally work it out lol
    0
  • cPanelMichael
    Hello, I'm happy to see you were able to address the issue. Thank you for updating us with the outcome.
    0

Please sign in to leave a comment.