View Full Version : Mod Rewrite Assistance
Emancipator
08-12-2004, 01:53 PM
Ola,
I have just learned how to do this whole mod rewrite deal just got started yesterday with some pretty good success, here is my Q for you smart folks.
I would like to turn this
http://www.moviesonline.ca/movie_details.php?movie=Dawn%20of%20the%20Dead
into this
http://www.moviesonline.ca/DawnoftheDead/
No spaces, no punctuation.... doable?
MarkB
08-12-2004, 03:22 PM
You could do Dawn-of-the-Dead with mod_rewrite and str_replace...
Emancipator
08-12-2004, 04:14 PM
have an htaccess example?
In terms of SEO, MarkB's suggestion would be better, because Google will see them as separate words rather than a bit of gibberish (in Google's 'eyes').
'Fraid I dont know how to do it with mod-rewrite though, I would use PHP.
intelliot
08-12-2004, 06:09 PM
I can do it. It'll take a little time and a combination of mod_rewrite and PHP. Let me know if you're interested (still looking for the solution) otherwise I won't waste my time:)
BTW I will be doing as MarkB suggested (hyphens to replace spaces)
P.S. Google recently stated (http://www.googlecommunity.com/about625.html) in their blog that hyphens are better than underscores.
Emancipator
08-13-2004, 06:27 AM
indeed hyphens are better then "_".
Not being familiar with making urls "spiffy" I want to use a method that will make it so google SEES the url correctly.
Ie, if I make it www.moviesonline.ca/zombiemovies.html I want google to see that and not gibberish, or just get confused.
Anybody willing to show me the best way i am gratefull for the time.
intelliot
08-14-2004, 12:38 AM
The best (and easier) way is to use mod_rewrite and replace spaces with hyphens. so that might be zombie-movies.html
Emancipator
08-16-2004, 05:56 AM
can you show me an example intelliot? very green to mod re-write.
intelliot
08-16-2004, 01:48 PM
I'll spend some time to write you a few rewrite rules and report back.
intelliot
08-16-2004, 01:53 PM
Example .htaccess file (untested)
RewriteEngine On
RewriteRule ^movie-([a-zA-Z0-9-]*)\?$ movie_details.php?movie=$1
This will make:
moviesonline.ca/movie-Dawn-of-the-Dead
the equivalent of:
moviesonline.ca/movie_details.php?movie=Dawn-of-the-Dead
In movie_details.php you will want to str_replace the hyphens with spaces. Make sure it's backwards-compatible for people using the old URLs.
Emancipator
08-16-2004, 04:15 PM
Thanks Elliot. Going to test it out right now. VERY much appreciated....
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.