Page 1 of 1

Regular expression help

Posted: Fri Feb 18, 2011 4:53 am
by itsmani1
Hi,

I need help in Regular expression.

For:

Code: Select all

http://test.example.com/MyPaper/Jobs-13-02-2011
I tried:

Code: Select all

RewriteRule ^MyPaper/Jobs-([0-9][0-9]\-[0-9][0-9]\-[0-9][0-9][0-9][0-9]) /test.php?cat_id=1&date=$2&paper_id=1
But it did not work... help please?

Thanks

Re: Regular expression help

Posted: Fri Feb 18, 2011 11:33 am
by ridgerunner
Your rewrite rule works just fine for me (that is, the redirection worked). I placed the following .htaccess file in the root directory and the rewrite works as expected.
[text]# Check if we have the mod_rewrite module available...
<IfModule mod_rewrite.c>

# Turn on the rewrite engine.
RewriteEngine on

RewriteRule ^MyPaper/Jobs-([0-9][0-9]\-[0-9][0-9]\-[0-9][0-9][0-9][0-9]) /test.php?cat_id=1&date=$2&paper_id=1
</IfModule>
[/text]
You did not provide any information about the type of error you received (more information is better). Here are a couple suggestions:
Ensure mod_rewrite is turned on.
Put the .htaccess in the root folder of your domain.

:)