SEO rewrite URL's problem

Topics: Developer Forum, User Forum
May 31, 2009 at 6:06 AM


I'm trying to rewrite:








so I use:

RewriteRule ^/([a-z]+)/([a-z]+)/([^/.]+)$ /index.php?c=$1&a=$2&p=$3 [L,I]

RewriteRule ^/([a-z]+)/([a-z]+)/(.*)$ /index.php?c=$1&a=$2&p=$3 [L,I]

RewriteRule ^/([a-z]+)/([a-z]+)/((.*)|())$ /index.php?c=$1&a=$2&p=$3 [L,I]

But neighter of above work.

In mod_rewrite I do it with this, (work perfectly):

RewriteRule ^([a-z]{1,})/([a-z]{1,})/(.*)?$ index.php?c=$1&a=$2&p=$3 [L,NC]

Where I get wrong?


May 31, 2009 at 11:05 AM

FYI... you can use \w+ for word boundries instead of [a-z]+

From what I can see, your second rewrite rule should at least catch. Just ensure you're original urls start with a forward slash /

Are your running your rules against the TestDriver.exe? That's the easiest way to test your rules.

Jun 1, 2009 at 5:22 AM

@mcwilliams132 - You are right for (\w+), it work and represents "word characters" (digits, underscore and letters).

But none of these 3 suggestions work for me. Server response is 500 (Internal Server Error).

These one seems to meet my requirements, but I have no luck.

RewriteRule ^/([a-z]+)/([a-z]+)/(.*)$ /index.php?c=$1&a=$2&p=$3 [L,I]

Unfortunately I haven't access to TestDrive.exe, I've work onto remote server.

Jun 1, 2009 at 11:32 AM

If you're working on a remote server, how did you setup IIRF?

Do you have access to the IIS MMC? The file system?

You first neet to ensure that IIRF is steup properly. Do any pages appear when browsing your site?

Jun 1, 2009 at 1:49 PM

Setup was made by other guy, who control the server. I think that IIRF work properly, at least partially, because next 2 statement redirects correctly:




RewriteRule ^/([a-z]+)/([a-z]+)$ /index.php?c=$1&a=$2 [L,I]




RewriteRule ^/([a-z]+)/$ /index.php?c=$1&a=index [L,I]


Here is full Iirf.ini (Only the last line doesn't work as I expect)

RewriteLog  c:\temp\iirf.wwwroot
RewriteLogLevel 5
MaxMatchCount 10

RewriteRule (.+\.)(js|css|gif|jpg|png|htc|jpeg)$ /$1$2 [L,I]

RewriteRule ^/$ /index.php?c=pages&a=index [L,I]

RewriteRule ^/(\w+)$ /index.php?c=$1&a=index [L,I]

RewriteRule ^/(\w+)/(\w+)$ /index.php?c=$1&a=$2 [L,I]

RewriteRule ^/(\w+)/(\w+)/(.*)$ /index.php?c=$1&a=$2&p=$3 [L,I]