: Lowercase 301 Redirects - Site Assets Disappear I am trying to force all my URLs to be lowercase, but in doing so, I lose the connection to all my site assets. I've added this to my in
I am trying to force all my URLs to be lowercase, but in doing so, I lose the connection to all my site assets.
I've added this to my in my .conf file:
RewriteMap lc int:tolower
And this to my .htaccess:
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule . ${lc:%{REQUEST_URI}} [R=301,L]
This is added before my final index.php declaration within the mod_rewrite area of the .htaccess
I'll post my full htaccess to view. pastebin.com/PsSsVVeR
Can you see what I'm doing wrong?
I apologise, but I'm relatively new at apache configuration.
More posts by @Harper822
1 Comments
Sorted by latest first Latest Oldest Best
I think the error is where you have placed these directives in your .htaccess file:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
# New directives inserted...
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule . ${lc:%{REQUEST_URI}} [R=301,L]
RewriteRule .* index.php [L]
RewriteRule ^index.php/(.*)$ [L]
The first 3 RewriteCond directives should apply to the RewriteRule .* index.php [L] directive - to prevent your site assets (files that exist) from being rewritten - but you've stuck your new directives in the middle! RewriteCond directives apply to the single RewriteRule that follows. As it is now, all your site assets are going to be redirected (internally rewritten) to index.php - which will make them "disappear"!
Try moving your two directives to the top of your .htaccess file (after you've enabled the RewriteEngine).
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.