Relative Content

Tag Archive for apache.htaccessmod-rewritehttpd.conf

Apache .htaccess rewrite rules not working

RewriteCond %{HTTPS} off [NC,OR] RewriteCond %{HTTP_HOST} ^(?!.*nohttps).*www [NC] RewriteRule (.*) https://example.com/$1 [R=301,L] Am I doing something wrong? These configuration files seem too difficult to understand. I hope someone with experience can help me. Thanks. I hope: http://nohttps.example.com https://nohttps.example.com main https://example.com http://example.com 301 main http://www.example.com 301 main https://www.example.com 301 main apache .htaccess mod-rewrite httpd.conf New contributor […]

Apache mod_rewrite How to strip slash off document root AND all URIs

I have apache-2.4.59 on fedora40 and trying to strip any trailing slash(es) from the root and any other URIs using RewriteCond/RewriteRule in my vhost config. I’ve tried a dozen different combinations of rewritecond and rewriterule but they always create a redirect loop for the document root URI because once the trailing slash is removed, it matches the same pattern, or the .htaccess in the document root starts the rewrite rules again.