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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:29:37+00:00 2026-05-13T14:29:37+00:00

My current htaccess file looks like this: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f [NC] RewriteCond

  • 0

My current htaccess file looks like this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]

This works fine for me, however I want to try and reduce server load so I have added this line just below the RewriteEngine On line to stop processing if loading static content:

RewriteCond %{REQUEST_FILENAME} !.*jpg$|.*gif$|.*png$|.*css$|.*js$|.*txt$|.*ico$|.*pdf$ [NC]

Is this the most efficient way of writing it? Thanks

  • 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-13T14:29:38+00:00Added an answer on May 13, 2026 at 2:29 pm

    In line 2 you already check for existence of the requested file (!-f), so there is no need to add your line, but you could replace line 2 with your new rewrite condition, if you want to avoid returning other files like .php files. Performancewise I do not think this will speed up apache though, and there is some other performance hole in your web application.

    That said, your pattern is probably not what you expected to be, as e.g. .*jpg$ matches mysuperjpg as well. You may be looking for \.jpg$, because . is a special character for regular expressions. You could do this:

    RewriteCond %{REQUEST_FILENAME} !\.(jpg|gif|png|css|js|txt|ico|pdf)$ [NC]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My current .htacces file looks like this: DirectoryIndex index.php RewriteEngine on RewriteCond $1 !^(index\.php|assets|robots\.txt|favicon\.ico)
My current .htaccess looks like this: RewriteEngine On # RewriteCond %{REQUEST_URI} !^/_project RewriteCond %{REQUEST_FILENAME}
My current htaccess looks like this: RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?site\.com [NC] RewriteCond %{REQUEST_FILENAME}
My current htaccess file is this: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d
My current .htaccess file contains the following lines: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule
My current .htaccess file Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^falsebase\.net
I have an htaccess file that uses mod_rewrite to redirect /controller to /index.php?controller=%controller% Like
My .htaccess file: RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)$ photo.php?id=$1 RewriteRule ^([a-zA-Z0-9_-]+)/$ photo.php?id=$1 My goal is
I have never done this before This is my current .htaccess file, I want
This should be a quick one... here is my current .htaccess file: # BEGIN

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.