![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: May 2005
Location: Colorful Colorado
Posts: 25
Rep Power: 0
![]() |
RewriteRule
I am having trouble creating a rewrite rule to make my PHP app pretty.
/any/number/of/directories/article/mode/admin/action/delete needs to be changed to /any/number/of/directories/articles/index.php?mode=admin&action=delete it should handle any number of arguments /any/number/of/directories/article/mode/user/action/attachement/id/0193 needs to be changed to /any/number/of/directories/articles/index.php?mode=user&action=attachment&id=0193 any ideas? is this possible?
__________________
How to ask questions the smart way |
|
|
|
|
|
#2 |
|
Programming Guru
![]() |
Of course it is...
404.php [php] <?php function urlFormat($str, $sep="article/") { $str = explode($sep, $str); $str[1] = explode("/", $str[1]); $tmp = "index.php?"; for($i=0;$i<count($str[1]);$i++) { $tmp .= "{$str[1][$i]}="; $i++; $tmp .= "{$str[1][$i]}"; if($i != count($str[1])-1) $tmp .= "&"; } return "{$str[0]}{$sep}{$tmp}"; } if(isset($_SERVER["REDIRECT_URL"])) header("Location: " . urlFormat($_SERVER["REDIRECT_URL"])); else die("404 Error Page..."); ?> [/php] httpd.conf (in the directory tag of your root web folder) ErrorDocument 404 /404.php If this doesn't work, tell me, it's been a while since i've messed with Apache configs.
__________________
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|