Page 1 of 1

reguller expression issue

Posted: Thu Nov 23, 2006 7:57 am
by itsmani1
Here is my .htaccess code, Its working fine but the problem is i want to optimize it.

Code: Select all

RewriteEngine On
RewriteRule ^contactus contactus.php
RewriteRule ^login login.php
RewriteRule ^signup signup.php
RewriteRule ^selltickets selltickets.php
RewriteRule ^aboutus aboutus.php
i tried to optimized it in this way:

RewriteEngine On
RewriteRule ^(/.*/) $1.php

but did not worked.
any help please

Posted: Thu Nov 23, 2006 8:04 am
by Ambush Commander
Hmm... that will be slightly difficult, because a catchall regex would also catch anything you didn't want to rewrite.

Can you cordon off all the scripts into their own little directory? Then:

Code: Select all

RewriteRule ^dir/([a-z]) dir/$1.php
...should do the tirkc.

Posted: Thu Nov 23, 2006 8:14 am
by itsmani1
won't it work in this way?

Code: Select all

RewriteRule ^/([a-z]+) /$1.php

Posted: Thu Nov 23, 2006 8:16 am
by Ambush Commander
As long as you don't have anything that is [a-z] in your root directory. Like folders.

Posted: Thu Nov 23, 2006 8:23 am
by itsmani1
well my requirement is :

http://www.dizyn.com/xxxxx
or
http://www.dizyn.com/xxxxx/


need to be forward at http://www.dizyn.com/xxxxx.php

that's all.

Posted: Thu Nov 23, 2006 8:36 am
by itsmani1
I tried this, it did not worked. I got flollowing result.

The requested URL /aboutus was not found on this server.

Code: Select all

RewriteRule ^/([a-z]+) /$1.php