Search friendly urls

Discuss practical ways rearrange URLs using mod_rewrite.

Postby Gert » Sat Jul 25, 2009 4:39 pm

I found out that I didn't set the paths right to the images. Certain images where in a subdir which I sort of forgot. So the backslash does work, so I'm referring to images now via '/subdir/images/image01.gif'.

Thanks, Richard.
Gert
 
Posts: 10
Joined: Sun Jul 19, 2009 6:26 pm

Postby Gert » Mon Jul 27, 2009 2:54 pm

Richard, forgot to ask you this before, but can you tell me why your redirect

Code: Select all
RewriteRule ^trips/([-a-z]+)/([-a-z]+)/([-a-z0-9]+)/?$ /tripsdir/showtrip.php?continent=$1&country=$2&title=$3 [QSA,L]


works different than lets say:

Code: Select all
RewriteCond %{QUERY_STRING} ^rc=EK$
RewriteRule ^reisroutes/toon_reis.php /reisroutes/toon_reis.php?rc=ECK [R=301,NC]


or

Code: Select all
RewriteRule ^nav/s-africa.html$ /trips/s-africa.php [R=301,NC]


where you will always end up with the destination url as your browser url whereas with your redirect the url will stay the same?

Thanks
Gert
 
Posts: 10
Joined: Sun Jul 19, 2009 6:26 pm

Postby richardk » Mon Jul 27, 2009 3:45 pm

The R flag (R=301) causes a redirect (changes the URL address bar) vs. without which causes** a "rewrite" (internal).

**A full URL can also cause a redirect
Code: Select all
RewriteRule ^nav/s-africa.html$ http://example.com/trips/s-africa.php [NC,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Gert » Mon Jul 27, 2009 3:59 pm

Thanks Richard for the explanation.
Gert
 
Posts: 10
Joined: Sun Jul 19, 2009 6:26 pm

Previous

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 18 guests

cron