Reputation: 13
Currently I have the below rules in my htaccess file. All files should redirect except if they have .htm or .html extensions
RewriteRule \.(htm|html)$ - [NC,L]
RewriteRule ^([A-Za-z0-9-+_./]+)/?$ index.php?page=$1&%{QUERY_STRING}
Now the problem is that tinyMce also has files with .htm, and in that case, the redirect should take place.
So, I want to prevent redirection on .htm files except when the folderstructure/url somewhere contains "tinyMCE" in it... How can I do this?
Upvotes: 1
Views: 104
Reputation: 133528
Based on your shown samples could you please try following. Trying to fix OP's attempt here, please make sure to clear your browser cache before testing your URLs.
RewriteEngine ON
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !tinyMCE [NC]
RewriteRule ^([A-Za-z0-9-+_./]+)/?$ index.php?page=$1&%{QUERY_STRING} [L]
2nd solution: Or try with following rules too, please try to put ONLY one set of rules either above OR these ones at a time.
RewriteEngine ON
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^((?!tinyMCE)[A-Za-z0-9-+_./]+)/?$ index.php?page=$1&%{QUERY_STRING} [L]
Upvotes: 1