Help with Reg Expressions

Discuss practical ways rearrange URLs using mod_rewrite.

Help with Reg Expressions

Postby jgf » Thu Apr 07, 2005 9:26 am

Hi I have a few things that I am attempting to mod rewrite and I am unsure how to implement a some of them. Here is what I have already for my .htaccess file for my domain.com

RewriteEngine On
Options +FollowSymlinks
RewriteBase /

RewriteCond %{REQUEST_URI} !pageA.shtml
RewriteRule ^([^/]+)/?$ /index.php?a=$1
RewriteCond %{REQUEST_URI} !pageA.shtml
RewriteRule ^([^/]+)/([^/]+)/?$ /index.php?a=$1&f=$2
RewriteCond %{REQUEST_URI} !pageA.shtml
RewriteRule ^([^/]+)/(page.shtml)/?$ /index.php?a=$1&f=$2

There are two things I need to happen
I need domain.com/anything to go to domain.com/index.php?a=$1
and I need domain.com/anything/something to go to domain.com/index.php?a=$1&f=$2

So far this works for directories, but when a .html, .htm or .shtml file is called it loads the file if it is there or it 404s and then redirects to the root. In fact it even screws up when the . is omited, (just somethinghtml, etc). As my code shows I have one specific .shtml file being rewritten, but I want all.

TIY
J

P.s. since I have multiple rewrite rules, if I want to use
RewriteCond %{REQUEST_URI} !pageA.shtml
do I have to repeat this for each rule that I want to apply it to as I have it now?
jgf
 
Posts: 2
Joined: Thu Apr 07, 2005 9:11 am

Postby jgf » Mon Apr 18, 2005 2:27 pm

anyone? TIA
jgf
 
Posts: 2
Joined: Thu Apr 07, 2005 9:11 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 74 guests

cron