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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:57:03+00:00 2026-05-27T17:57:03+00:00

I have an htaccess rewrite setup in my PHP application to route files via

  • 0

I have an htaccess rewrite setup in my PHP application to route files via the bootstrapper file. In essence, the goal is to take a URL such as http://www.domain.com/view/key/value/key/value where the view would route accordingly and the key/value pairs would be available via a function I wrote in the bootstrapper to the views. All was working well…

That is, until I started doing ajax-y stuff. I’m routing all my ajax queries through a single file, ajaxDispatcher.php. When I did that, the htaccess (correctly) caught the request and used my bootstrapper to route it inappropriately. Similarly, it was attempting to route unwanted files such as .ico, .css, etc.

I figured out the file extension routing exception, however, I’ve not been able to have .htaccess ignore rewrite rules for the single file ajaxDispatcher.php. Here’s where my code stands:

 RewriteEngine On
 RewriteBase /
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^/ajaxDispatcher.php$ $0 [L]
 RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php?route=$1 [L]

How do I get .htaccess to ignore the routing rules only for ajaxDispatcher?

  • 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-27T17:57:04+00:00Added an answer on May 27, 2026 at 5:57 pm

    You should move your new rule atop the RewriteCond block:

    RewriteRule ^/?ajaxDispatcher.php$ - [L]
    

    Otherwise the RewriteConditions don’t cover the extensions RewriteRule anymore, for which I assume they are intended.

    Another alternative is turning it into another RewriteCond of course:

    RewriteCond %{SCRIPT_NAME}  !ajaxDispatcher
    

    Or injecting it as assertion into the final RewriteRule (?!ajaxDispatcher.php).

    The ordering thing is best explained on Serverfault: https://serverfault.com/questions/214512/everything-you-ever-wanted-to-know-about-mod-rewrite-rules-but-were-afraid-to-as

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

Sidebar

Related Questions

I have a CI application that uses .htaccess for URL routing. My basic setup
I have problems with static files url rewriting in current .htaccess setup on Apache2.
I have an htaccess file that uses mod_rewrite to redirect /controller to /index.php?controller=%controller% Like
I have an .htaccess file with following content: AddHandler x-httpd-php5 .php For some reason,
I have all my rewrite rules setup and working in .htaccess but I need
I have a subdomain setup as onlinedev.domain.com I need to use htaccess to rewrite
I'm wondering, if I have an .htaccess rewrite setup on a virtual subdomain, ie.
Possible Duplicate: Redirect *.htm to *.php htaccess rewrite if redirected file exists I set
I have this htaccess code: RewriteEngine on RewriteBase /xm/ RewriteCond %{REQUEST_URI} !^/index.php$ RewriteRule ^([a-z0-9]*)\.php$
I have a .htaccess file in the root of a website: /var/www/mywebsite/htdocs/.htacess and I

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.