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 6875411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:19:11+00:00 2026-05-27T04:19:11+00:00

I have the following code in ://localhost/.htaccess… AddType application/x-httpd-php5 .css .js RewriteEngine on RewriteRule

  • 0

I have the following code in ://localhost/.htaccess…

AddType application/x-httpd-php5 .css .js

RewriteEngine on
RewriteRule .*\/scripts(.+) scripts$1 [QSA]
RewriteRule .*\/themes(.+) themes$1 [QSA]
RewriteRule !\.(css|xhtml|xml|zip)$ rewrite.php

Goal: To be able to use files in the ://localhost/scripts/ and ://localhost/themes/ directories for more than one site. Using the QSA flag I’ve been able to get both the directory and files (from both directories) to be accessible.

So…

://localhost/site1/scripts/

://localhost/site2/scripts/

…both access…

://localhost/scripts/

…and all the files in the directory as well of course.

The Problem: I’m not sure how to adapt the PHP execution in .js and .css files with this setup. In my current setup I have the files override the mime/media type using PHP. I have tried reordering the code around unsuccessfully so I’m not sure this is an order-of-execution problem. JavaScript files in example are being served as “application/x-httpd-php5” instead of actually executing PHP.

Clarifications

  • The rewrite rule for file extensions is truncated intentionally so ignore that.

  • This has absolutely nothing to do with redirects.

  • I have tried symbolic links however apparently the alias command only works in the server configuration.

  • Presume I have absolutely no access to the server configuration, I can only use .htaccess (I need to mirror this eventually in a live environment on shared hosting).

  • I have rearranged the commands and have even used separate .htaccess files in numerous combinations.

  • 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-05-27T04:19:12+00:00Added an answer on May 27, 2026 at 4:19 am

    Turns out I somehow ended up mixing up AddHandler and AddType!

    AddHandler application/x-httpd-php .js
    AddType text/javascript .js
    
    RewriteEngine on
    RewriteRule .*/scripts(.+) scripts$1 [QSA]
    RewriteRule .*/themes(.+) themes$1 [QSA]
    RewriteRule ^(|site1/|site2/|file\.php) - [L]
    RewriteRule !\.(css|xhtml|xml|zip)$ rewrite.php
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have in my .htaccess the following code: RewriteEngine On RewriteRule ^/?([^/\.]+)/?$ $1.php [L]
I have the following code in my .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME}
I have the following code: from selenium import selenium selenium = selenium(localhost, 4444, *chrome,
I have following code in my application: // to set tip - photo in
I have following code in my Application. Comments in my code will specify My
I have following code in my application. [self.navigationController pushViewController:x animated:YES]; It will push a
i have the following code; $(#testbtn).live(click, function(){ $(#targetdiv).load(http://localhost/test/test.php); }); but it is not working
I have the following code in php: <?php $con = mysql_connect(localhost,john,john); mysql_select_db(data, $con); if
I have the following code: $.ajax({type: 'get', mode: 'abort', dataType: 'json', url: 'http://localhost/1.php', data:
I have following simple code for a word/tag in a tagcloud: <a about=http://localhost/d456c6 href=http://localhost/d456c6

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.