| Coding Forum Problems with your code? Let's hear about it. |
06-06-2004, 08:17 AM
|
#1 (permalink)
|
|
Possible Terrorist
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 4,904
|
mod_rewrite help
hey.. how would I make anyone that goes to
staticdirectory/test.php
be "masked" to
view.php?id=test
__________________
Kyle Varga
"m3lt/theSpear"
student, web designer/coder, future IT consultant
Experience: PHP/MySQL, Java, C++, MS-SQL
|
|
|
06-06-2004, 09:03 AM
|
#2 (permalink)
|
|
v7n Mentor
Join Date: 10-11-03
Posts: 1,148
Latest Blog: None
|
RewriteEngine On
RewriteRule ^view.php\?id=([a-zA-Z0-9]*)$ staticdirectory/$1.php
Not tested but essentially it sets any uppercase, lowercase, or number here [a-zA-Z0-9] to $1
|
|
|
06-06-2004, 09:49 AM
|
#3 (permalink)
|
|
Possible Terrorist
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 4,904
|
I used
[code:1:31c1c26157]RewriteEngine On
Options +FollowSymlinks
RewriteRule ^category/(.*).php /script/view.php?site=$1[/code:1:31c1c26157]
and it works fine. thanks for the help
__________________
Kyle Varga
"m3lt/theSpear"
student, web designer/coder, future IT consultant
Experience: PHP/MySQL, Java, C++, MS-SQL
|
|
|
06-06-2004, 10:40 AM
|
#4 (permalink)
|
|
v7n Mentor
Join Date: 10-11-03
Posts: 1,148
Latest Blog: None
|
Oh... was interpreting you backwards.
I did much the same for my affiliates script
Options FollowSymLinks
RewriteEngine On
RewriteRule ^category([0-9]*).html affiliates.php?cat=$1
|
|
|
06-06-2004, 11:14 AM
|
#5 (permalink)
|
|
Possible Terrorist
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 4,904
|
modrewrite is awesome 
__________________
Kyle Varga
"m3lt/theSpear"
student, web designer/coder, future IT consultant
Experience: PHP/MySQL, Java, C++, MS-SQL
|
|
|
06-06-2004, 08:11 PM
|
#7 (permalink)
|
|
Possible Terrorist
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 4,904
|
i think because its getting stuck.. wouldnt it start rewriting index.php stuff too?
__________________
Kyle Varga
"m3lt/theSpear"
student, web designer/coder, future IT consultant
Experience: PHP/MySQL, Java, C++, MS-SQL
|
|
|
06-06-2004, 08:59 PM
|
#8 (permalink)
|
|
v7n Mentor
Join Date: 10-11-03
Posts: 1,148
Latest Blog: None
|
Hmm... it shouldn't because of the /$ end marker..
.* should be any character.. maybe it's getting stuck on the -'s
|
|
|
06-06-2004, 10:12 PM
|
#9 (permalink)
|
|
v7n Mentor
Join Date: 10-11-03
Posts: 1,148
Latest Blog: None
|
I got it..
RewriteEngine On
RewriteBase /foldername/
RewriteRule ^(.*)-(.*)$ index.php?urlcat=$1-$2
RewriteRule ^(.*)-(.*)-(.*)$ index.php?urlcat=$1-$2-$3
had to put it in twice to cover 2 different situations.
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| mod_rewrite |
Limit |
Coding Forum |
0 |
03-31-2005 02:08 PM |
| Mod_Rewrite |
SN3 |
Coding Forum |
1 |
03-06-2005 10:27 AM |
| mod_rewrite |
John Scott |
Coding Forum |
13 |
01-17-2004 02:57 PM |
All times are GMT -7. The time now is 05:36 AM.
© Copyright 2008 V7 Inc
|