Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to hack the CSS files on OSTicket by replacing them with my own custom ones when a specific URL is accessed.

The URL that is accessed for this example is:
http://example.com/helpdesk/scp/css/main.css

and I would like it to use the CSS file at:
http://example.com/test.css

Why won't this .htaccess file (in web root, not /helpdesk/scp/) work? Is there an easy way to debug these rules, some way to find out what Apache did when the URL was accessed and where it's failing? error.log doesn't show anything useful.

RewriteEngine On

RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)main\.css$ /test.css [NC, L]
share|improve this question

migrated from serverfault.com Feb 21 '11 at 21:42

This question came from our site for system and network administrators.

Delete space between NC, and L. Also check AllowOverride All (or FileInfo):

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)main\.css$ /test.css [NC,L]
share|improve this answer
    
Thank you! Turned out that I not only had AllowOverride to None (I didn't write the config, but should have checked it) and once that was fixed I realized mod_rewrite wasn't even loaded. – Anthony Hiscox Feb 16 '11 at 18:38

See the documentation on RewriteLog and RewriteLogLevel for how to debug rewrite rules.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.