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. the bit about newform.php:
1.a. DirectoryIndex
Pros:
Cons:
1.b. RedirectMatch
Pros:
Cons:
1.c. RewriteRule
Pros:
Cons:
2. The rest…
2.1. Using mod_rewrite
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
MultiViewsoption: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
ErrorDocumentinside pending folder for this scenarioAnd then also check
$_SERVER["REQUEST_URI"]So, there you have it… both with and without mod_rewrite 😉 The decision is yours 😉