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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:27:52+00:00 2026-06-06T23:27:52+00:00

My attempt to do this is… <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$

  • 0

My attempt to do this is…

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule \.js$ js.php [L]   ## This line is the one I tried to add
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

If I use a tag <script type='text/javascript' src='http://www.domain.net/myfile.js'></script> I would like it to go through js.php.

js.php
Will handle the file using header('....'); echo file_get_contents('myfile.js');

I have tried so many things to do this, I had done this before on a project but I can’t remember where now as I have to redo it 🙂

Hope it makes sense…

  • 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-06T23:27:53+00:00Added an answer on June 6, 2026 at 11:27 pm

    You can add the following rewrite rule :

    RewriteRule ^([^\.]+)\.js$ js.php [NC,L]
    

    In place of :

    RewriteRule \.js$ js.php [L]   ## This line is the one I tried to add
    

    The result is :

    http://www.domain.net/myfile.js => http://www.domain.net/js.php
    http://www.domain.net/foo/bar/myfile.js => http://www.domain.net/js.php
    

    Or you can do as follows :

    RewriteRule ^([^\.]+)\.js$ $1.php [NC,L]
    

    The result is :

    http://www.domain.net/myfile.js => http://www.domain.net/myfile.php
    http://www.domain.net/foo/bar/myfile.js => http://www.domain.net/foo/bar/myfile.php
    

    Some explanations about used RewriteRule flags :

    • NC : Use of the [NC] flag causes the RewriteRule to be matched in a case-insensitive manner. That is, it doesn’t care whether letters appear as upper-case or lower-case in the matched URI.
    • L : The [L] flag causes mod_rewrite to stop processing the rule set. In most contexts, this means that if the rule matches, no further rules will be processed. This corresponds to the last command in Perl, or the break command in C. Use this flag to indicate that the current rule should be applied immediately without considering further rules.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my second attempt at this question . I made a mess of
Why does this attempt at creating a list of curried functions not work? def
Alright so I've been making an attempt at this for a while now. My
First attempt to use this cool site - after searching for 2 hours: So
I'll attempt to illustrate this with an example. Take a common example of a
This is my first attempt at responsive design, so I'm keeping it simple. I
This is my first attempt to write shorthand if statements however am befuddled by
Because this is my first attempt at an extension method that seems quite useful
this if my first attempt at using streaming for WCF, and I am struggling
This is my first attempt to create a GUI in MATLAB. I haven't been

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.