Any questions involving matching text strings to patterns - the pattern is called a "regular expression."
Moderator: General Moderators
-
itsmani1
- Forum Regular
- Posts: 791
- Joined: Mon Sep 29, 2003 2:26 am
- Location: Islamabad Pakistan
-
Contact:
Post
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
-
Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
Post
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.
-
itsmani1
- Forum Regular
- Posts: 791
- Joined: Mon Sep 29, 2003 2:26 am
- Location: Islamabad Pakistan
-
Contact:
Post
by itsmani1 »
won't it work in this way?
Last edited by
itsmani1 on Thu Nov 23, 2006 8:18 am, edited 1 time in total.
-
Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
Post
by Ambush Commander »
As long as you don't have anything that is [a-z] in your root directory. Like folders.
-
itsmani1
- Forum Regular
- Posts: 791
- Joined: Mon Sep 29, 2003 2:26 am
- Location: Islamabad Pakistan
-
Contact:
Post
by itsmani1 »
-
itsmani1
- Forum Regular
- Posts: 791
- Joined: Mon Sep 29, 2003 2:26 am
- Location: Islamabad Pakistan
-
Contact:
Post
by itsmani1 »
I tried this, it did not worked. I got flollowing result.
The requested URL /aboutus was not found on this server.