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

The Archive Base Latest Questions

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

I have the following rule that redirects all traffic to index.php when public folder

  • 0

I have the following rule that redirects all traffic to index.php when public folder is visited. How can I modify it to exclude .png files? That means, if /public/something.png is visited, it should render in the browser or should be accessible inside the code when called using an:

"<img src='/public/example.png'>".

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -s [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -l [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

RewriteRule ^.*$ index.php [NC,L]
  • 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:48:09+00:00Added an answer on May 13, 2026 at 2:48 pm

    I usually use a RewriteCond directive to specify extensions of static media content that I don’t want redirected to a Front Controller. The pipe (|) chars mean “or”, so you can add or remove extensions in this rule to work for whichever ones you don’t want redirected:

    RewriteCond $1 !\.(js|ico|gif|jpg|png|css|swf|mp3|wav|txt|xml)$
    

    Edit

    Commenters are correct, if you use that exact line, the $1 needs some context. In your particular case, you could alter it slightly and put it on your index.php RewriteRule line instead, like this:

    RewriteRule !\.(js|ico|gif|jpg|png|css|html|swf|mp3|wav)$ index.php [NC,L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following rule which redirects all pages - except php and php3
I have the following .htaccess rule: RewriteEngine on RewriteRule ^(.*) http://www.server2.com/index.php?action=$1 I need to
In my .htaccess file I have defined following rule, RewriteRule t/([^.]+)/$ /videos/tag.php?tag=$1 [QSA] The
I have a PHP scripted named index.php inside a folder named blog. There are
I have web servers behind a load-balancer. They all have the following rule to
I currently have a simple rewrite that redirects /photos/2 to /photoviewer.php?photo=2 However I need
I have the following rule in htaccess: RewriteRule ^([a-zA-Z0-9\-\_]+)/?$ test.php?&url=$1 [L] My question is
I have the following rewrite rule: <rewrite url=^/Membership/(.+)/(.+)/(.+)/(.+) to=/Membership/Index.aspx?parentf=$3&amp;f=$4/> which I am expecting should
I have the following rule in my current .htaccess file to redirect /videos/login/ requests
I have created following rule in the .htaccess file located at the root of

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.