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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:13:28+00:00 2026-05-26T10:13:28+00:00

I use .htaccess Mod Rewrite to send the URL to index.php, which then parses

  • 0

I use .htaccess Mod Rewrite to send the URL to index.php, which then parses the URL and builds each page of my website.
This works perfectly fine, allowing me to easily manage clean URLs using PHP instead of .htaccess.

Ex: http://domain.com/some/url/here/ -> goes to index.php, which loads a page with multiple PHP files put together

However, I’m trying to allow certain PHP files to load as regular PHP files (without sending the URL to index.php to parse).

Ex: http://domain.com/some/url/here/ still works as mentioned above.
http://domain.com/specialexception.php will load as a regular php file, without sending to index.php

I have the following code:

<IfModule mod_rewrite.c>

    RewriteEngine On

    RewriteCond $1 !^specialexception\.php$ [NC]
    RewriteRule !\.(css|gif|jpg|png|ico|txt|xml|js|pdf|htm|zip)$ /path/to/index.php [NC,L]

</IfModule>

However, the RewriteCond line is simply ignored right now.

I would appreciate any help/ideas!

Thank you.

  • 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-26T10:13:29+00:00Added an answer on May 26, 2026 at 10:13 am

    I figured it out, though I’m not sure why this works:

    I switched the rules around so they happened in reverse order.
    Code that works is as follows:

    RewriteCond %{REQUEST_URI} !\.(css|gif|jpg|png|ico|txt|xml|js|pdf|htm|zip)$
    RewriteRule !(specialexception)+\.php)$ /path/to/index.php [NC,L]
    

    The problem with this solution:
    Since “specialexception.php” is listed as the last rule, in the actual RewriteRule line, it only solves the problem for ONE file exception.

    One messy way around this might be to use the pipe in the last line of regex:

    RewriteCond %{REQUEST_URI} !\.(css|gif|jpg|png|ico|txt|xml|js|pdf|htm|zip)$
    RewriteRule !(specialexception|anotherexception|foo|bar)+\.php)$ /path/to/index.php [NC,L]
    

    If anyone has a better idea on how to add multiple exceptions for multiple files, I’d love to know!

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

Sidebar

Related Questions

I use mod_rewrite/.htaccess for pretty URLs. I forward all the requests to my index.php,
is possible to exclude a url being parsed by mod rewrite? my .htaccess has
I know how to make URL's rewrite, for example: www.example.com/index.php?id=1&cat=3 to www.example.com/1/3/ (or whatever).
Hi I'm trying to code a mod rewrite that redirects /example to /example.php .
I have installed rewrite_module and modified php.ini on Apache. I create rewrite.php and .htaccess
I want to rewrite URLs using .htaccess I want mod_rewrite to match ANY URL
At present my joomla urls are showing up like http://www.website.com/index.php/gallery instead of http://www.website.com/gallery.php So
I want to rewrite an url like this: http://www.piata-bio.ro/presa-bio.php?var1=http://news.google.com/news/url?sa=t&fd=R&usg=AFQjCNHmU7U7bXtlH9Lo8dXfBs64PqxgbA&url=http://www.eva.ro/divertisment/stiri/un-nou-concept-de-magazin-articol-35491.html to something like this :
So what I am trying to do is create a website where the index.php
I need to use .htaccess file to replace a word in a URL; something

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.