Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9062883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:50:55+00:00 2026-06-16T15:50:55+00:00

I am using WordPress on RHEL6, and have some rewrites so that CSS is

  • 0

I am using WordPress on RHEL6, and have some rewrites so that CSS is hosted at http://servername/css rather than http://servername/wp-content/themes/themename/css/.

I am moving from an Nginx install to Apache, and own the server. In that case, I don’t want to use htaccess for redirects, I just want them in the httpd.conf. If I enable htaccess and put this in there, it all seems to work fine.

In my conversion, I added the / at the beginning of the rule. The current code below works for everything, except real files not handled by the css, js, img, font rules. As in, things that are actually hosted under /assets or other directories. I have a feeling this is due to the REQUEST_FILENAME, and if anything, a slash missing for the next rule – but I can’t seem to figure it out.

RewriteRule ^/index\.php$ - [L]
RewriteRule ^/css/(.*) /wp-content/themes/themename/css/$1 [QSA,L]
RewriteRule ^/js/(.*) /wp-content/themes/themename/js/$1 [QSA,L]
RewriteRule ^/img/(.*) /wp-content/themes/themename/img/$1 [QSA,L]
RewriteRule ^/font/(.*) /wp-content/themes/themename/font/$1 [QSA,L]
RewriteRule ^/plugins/(.*) /wp-content/plugins/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

If I try to access http://servername/assets/image.png, I actually am being rewritten to /index.php, from the rewrite log

init rewrite engine with requested uri /assets/311.jpg
applying pattern '^/index\.php$' to uri '/assets/311.jpg'
applying pattern '^/css/(.*)' to uri '/assets/311.jpg'
applying pattern '^/js/(.*)' to uri '/assets/311.jpg'
applying pattern '^/img/(.*)' to uri '/assets/311.jpg'
applying pattern '^/font/(.*)' to uri '/assets/311.jpg'
applying pattern '^/plugins/(.*)' to uri '/assets/311.jpg'
applying pattern '.' to uri '/assets/311.jpg'
RewriteCond: input='/assets/311.jpg' pattern='!-f' => matched
RewriteCond: input='/assets/311.jpg' pattern='!-d' => matched
rewrite '/assets/311.jpg' -> '/index.php'

/assets is a real folder that has real images. By looking at this log, it would make me think that !-f should have said ‘yes, this is a file’, rather than passing it to index.php afterwards.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T15:50:56+00:00Added an answer on June 16, 2026 at 3:50 pm

    After doing some research and testing, I found this was easily related to the difference in scope between htaccess and httpd.conf, and needing to include DOCUMENT_ROOT

    If you are using htaccess in /var/www/html/test/, you will only be looking in /test, and therefore something like test/assets/image.jpg would pass, because /assets/image.jpg is valid.

    In the case of httpd.conf though, unless you use these rules inside a Directory directive, you are not pathed to the virtual host folder. So in my case, it was looking for /assets/image.jpg off the root of the server.

    To get around this, I just had to include %{DOCUMENT_ROOT} before %{REQUEST_FILENAME}.

    My final block in httpd.conf looks like:

    RewriteRule ^/index\.php$ - [L]
    RewriteRule ^/css/(.*) /wp-content/themes/themename/css/$1 [QSA,L]
    RewriteRule ^/js/(.*) /wp-content/themes/themename/js/$1 [QSA,L]
    RewriteRule ^/img/(.*) /wp-content/themes/themename/img/$1 [QSA,L]
    RewriteRule ^/font/(.*) /wp-content/themes/themename/font/$1 [QSA,L]
    RewriteRule ^/plugins/(.*) /wp-content/plugins/$1 [QSA,L]
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm using wordpress, i have a page that i can access like this http://mywebsite/category/page
Im using wordpress 3.0 here: http://www.adventure-service.com On homepage i am using template that creates
Using Wordpress I have created a multiple select box so that users can select
I'm using wordpress and I have a form that I need to validate. I
I am using Wordpress Custom Field Template Plugin - http://wordpress.org/extend/plugins/custom-field-template/ I create some File
Using Wordpress, i have a plugin that inserts a playable MP3 on the page.
I am using wordpress and I have a folder under wp-content/ structured as: folder
Im using wordpress for my website and i have a massive amount of data
I am using WordPress I have put an extra container in the navigation menu.
I just started out using wordpress as a CMS. On the site I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.