Mobile app version of vmapp.org
Login or Join
Harper822

: 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

@Harper822

Posted in: #Apache #Htaccess #HttpdConf #Virtualhost

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.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Harper822

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ann8826881

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).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme