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

  • Home
  • SEARCH
  • 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 7709577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:53:50+00:00 2026-06-01T00:53:50+00:00

Ok so I have a site that needs to have 2 RewriteRules on it.

  • 0

Ok so I have a site that needs to have 2 RewriteRules on it.

First if you go to newvendor.business.com it will go to newvendor.business.com/newform.php

Second I need it to go from newvendor.business.com/pending to newvendor.business.com/pending/index.php when you click on the link with that id. Here is the htaccess file that works for the first rule but not then pending one.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z_]+)/?([a-zA-Z_+]+)?/?([0-9]+)?/? $1.php?action=$2&id=$3 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-p
RewriteRule ^pending/([0-9]*)$ /pending/index.php?id=$1

Can you do this or not? If so can someone help me with it?

  • 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-01T00:53:51+00:00Added an answer on June 1, 2026 at 12:53 am

    1. the bit about newform.php:

    1.a. DirectoryIndex

    DirectoryIndex newform.php index.php index.html
    

    Pros:

    • The URI actually stays "/" , and not "/newform.php".

    Cons:

    • Maybe you do want users to see "/newform.php"
    • Beware having newform.php anywhere in sub folders – DirectoryIndex setting is inherited and you might end up with an unexpected result (though this is pretty far fetched scenario).

    1.b. RedirectMatch

    RedirectMatch ^/$ /newform.php
    

    Pros:

    • Precision – only this specific URI is being redirected (sub folders not affected).

    Cons:

    • None that i can think of at the moment

    1.c. RewriteRule

    RewriteRule ^/$ /newform.php [R,L]
    

    Pros:

    • emm.. using mod_rewrite to make me a sandwich?

    Cons:

    • Invoking mod_rewrite is not a very light operation, although irrelevant if you’re going to use mod_rewrite for other rules…

    2. The rest…

    2.1. Using mod_rewrite

    RewriteEngine On
    
    RewriteRule ^pending/([0-9]+)$ pending/index.php?id=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([a-zA-Z_]+)/?([a-zA-Z_+]+)?/?([0-9]+)?/? $1.php?action=$2&id=$3 [L,QSA]
    

    Basically, i changed rules order, since your "first" one was matching pending/[0-9]+$ as well and control never reached beyond that point.

    2.2. Leveraging MultiViews

    Although this won’t be a pure configuration-only solution (will require some changes in php files), this may let you avoid using mod_rewrite…

    So, in order to do this, you need to enable MultiViews option:

    Options +MultiViews
    

    Then you just construct a "pretty" URL like "/article/123/edit" and, if there’s a file called article.php, it will be invoked, although you didn’t mention the .php extension
    Then, article.php file can grab $_SERVER["REQUEST_URI"] and parse it the way it sees fit…

    As for the pending/* – it is possible to use ErrorDocument inside pending folder for this scenario

    ErrorDocument 404 index.php
    

    And then also check $_SERVER["REQUEST_URI"]

    So, there you have it… both with and without mod_rewrite 😉 The decision is yours 😉

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

Sidebar

Related Questions

I have a site written in Delphi that needs to get data from a
I have a site that needs to use mod_rewrite to direct traffic to www.example.com
I'm going to have a single site that needs to be themed a number
I have a web site to do with alcohol that needs to verify the
I have a win form that creates a site in IIS7. One function needs
I have items in a list in a SharePoint 2003 site that I need
I have a site, say www.test.com . Now I need to get see the
I need to do rewrites so that the pages: http://www.site.com/page-one http://www.site.com/page-two http://www.site.com/page-three http://www.site.com/page-four Are
I have an application that works great when using the full url: sitename.com/index.php/foo/ but
I need to prevent second directory depth or deeper placed strings from matching first

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.