PDA

View Full Version : mod_rewrite question


The-Ensemble
03-10-2008, 03:39 PM
I've heard using mod_rewrite is the best way to get a more clean url.

I have file.php?do=view&id=X and I want to change to file.php?id=X like how forumdisplay.php works, what would the rewrite rule be for it? :confused:

Thanks

Opserty
03-10-2008, 07:57 PM
You need the do=view part for the script else it may not function properly.

You might be able to do something like file.php/view/X or something but I don't know much about mod_rewrite so I'll let someone else advise you.

MoT3rror
03-10-2008, 08:13 PM
I am just learning mod_rewrite but here is a try
RewriteRule ^file.php?id=([^/]*)$ /file.php?do=view&id=$1
I don't promise this will work but it may help you get closer.