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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:51:10+00:00 2026-06-12T23:51:10+00:00

I have the following in my htaccess file: RewriteEngine On RewriteRule ^(.*)$ rewrite.php?data=$1 [L,QSA]

  • 0

I have the following in my htaccess file:

RewriteEngine On
RewriteRule ^(.*)$ rewrite.php?data=$1 [L,QSA]

From rewrite.php I redirect to the correct pages depending on the url. Problem is that it redirects all files including css and js. I tried including these files but I now realise that was dumb of me. Should I redirect when there is and appropriate extension in the url? If redirecting is the way to go what method would be best? header location or HTTP_redirect?

Or is this not a good idea performance or work involved wise? I could go for something like this but I know next to nothing about apache and would rather not work with it right now.

RewriteRule ^(.*).css$ /includes/compressor.php?i=$1.css [L]

I previously had the following in my htaccess file:

RewriteCond %{REQUEST_FILENAME} !-f

I decided to remove this because:

  1. I would not be able to include the header and other common files in the rewrite.php file. I would also not be able to have a database call in the rewrite file that would determine the page to include and to reuse the data for the page contents.

  2. Unwanted files would be reachable such as service used only by external app.

  • 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-12T23:51:11+00:00Added an answer on June 12, 2026 at 11:51 pm

    How about redirecting only if the requested file does not exist on the server?

    You could use the following rewrite conditions to achieve this.

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(.*)$ rewrite.php?data=$1 [L,QSA]
    

    So if the request is for a CSS/JS/HTML/Image file that already exists on the server then no rewriting takes place and the request for the file is processed. If the file does not exist, it will run your rewrite rule to rewrite.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my .htaccess file I have defined following rule, RewriteRule t/([^.]+)/$ /videos/tag.php?tag=$1 [QSA] The
I have the following in a .htaccess file as a test: RewriteEngine on RewriteRule
I have the following in a .htaccess file redirect 301 /page.php http://domain.com/page Which works
In my .htaccess file i have the following re-write rule RewriteRule ^([a-z]*)$ work.php?album=$1 [L]
i have the following .htaccess file for me web Options +FollowSymLinks RewriteEngine on RewriteRule
I have the following rewrite in my .htaccess file which removes the .php extension
I have the following in my .htaccess file: Options +FollowSymlinks RewriteEngine On RewriteRule ^$
I have the following .htaccess file in a directory: RewriteEngine On RewriteCond %{HTTPS} !=on
So I have the following .htaccess file contents from my other project which is
I have the following rule in my current .htaccess file to redirect /videos/login/ requests

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.