View Full Version : help with mod_rewrite
Brute
03-02-2002, 02:36 PM
Anyone here using mod_rewrite, php and .htaccess to create search engine friendly urls?
something like: http://www.bla.com/articles/25 instead of http://www.bla.com/articles.php?id=25
I can't get it to work. Anyone who can help me out?
Thanks
- - -
Brute D.
Stewart
03-02-2002, 03:13 PM
hi!
just what im implementing in my new site now, it requires htaccess and a bit of php:
http://www.promotionbase.com/article/485
fatal
03-02-2002, 08:02 PM
how exactly do you do it? some code or a site with a tutorial would be nice :)
[EDIT]
haha, im an idiot, didnt realize that link was for that :O
El_Nino
03-02-2002, 09:43 PM
Try looking at this article: Building dynamic pages with search engines in mind (http://phpbuilder.com/columns/tim20000526.php3)
Edit: Sorry, that's the wrong link, I thought it was for something else, if I can find the link I was thinking of, I'll post it.
Brute
03-03-2002, 06:12 AM
Originally posted by Stewart
hi!
just what im implementing in my new site now, it requires htaccess and a bit of php:
http://www.promotionbase.com/article/485
Which one of these methods do you use?
I also found another tutorial and other method at:
http://www.alistapart.com/stories/succeed/
Have been trying it, but it gives me Parse Errors
Stewart
03-03-2002, 07:17 AM
i think the sitepoint tutorials look a lot easier to follow, I would recommend the third way on sitepoint. it has the least downpoints and is fully search engine compatible
Brute
03-03-2002, 10:36 AM
ok, thanks
will give it a try :)
- - -
Brute
riffola
03-06-2002, 04:08 PM
Try this
RewriteEngine On
RedirectMatch 301 ^/article$ /article/
RewriteRule ^article/$ /article.php [L]
RewriteRule ^article/(.*)/$ /article.php?id=$1 [L]
nyoung
03-07-2002, 04:54 PM
if you don't necessarily want to use .htaccess or mod_rewrite, you can place this code block at the top of your page:
$url_array = explode("/",$PATH_INFO);
if (count($url_array) > 1) {
for($i=1;$i<count($url_array);$i++) {
$data[$url_array[$i]] = $url_array[++$i];
}
extract($data);
}
Format url parameters like /variable1/value1/variable2/value2/
example:
http://www.domain.com/id/30/color/red/number/2/
To retrieve the values:
<?
echo $id //returns 30
echo $color //returns red
echo $number //returns 2
?>
Stewart
03-07-2002, 05:06 PM
thats what is on sitepoint, u still need to modify htaccess though
nyoung
03-07-2002, 05:51 PM
I currently use it with no modification to .htaccess what so ever :-)
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.