GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   anyone know how to do a simple url rewrite? (https://gfy.com/showthread.php?t=800467)

xanx 01-17-2008 11:09 PM

anyone know how to do a simple url rewrite?
 
All I want to do is change a URL that looks like this

/downloads/?dl_cat=3

to something like

/downloads/name-of-download/

I can't seem to get it to work :disgust

vending_machine 01-17-2008 11:51 PM

Code:

RewriteEngine On
RewriteRule downloads/?dl_cat=([[:digit:]]+) /downloads/$1/ [R,L]

Assuming "name of download" in that example is 3? I think that ought to do it..

SmokeyTheBear 01-18-2008 12:31 AM

heh i think he wants the opposite of that ( se friendly urls )

BV 01-18-2008 12:32 AM

is this kindergarten?

cezam 01-18-2008 02:00 AM

Ok you need to do this:

Modify your script so that it takes name of the download as a parameter, eg:

/downloads/?dl_name=name_of_download

then, edit your .htaccess file:

Code:

RewriteEngine On
RewriteRule downloads/?dl_name=([A-Za-z0-9_-]+)$ /downloads/$1/

This should work.

cezam 01-18-2008 02:05 AM

sorry i screwed up, the htacces should be:

Code:

RewriteEngine On
RewriteRule  /downloads/([A-Za-z0-9_-]+)/$ downloads/?dl_name=$1


Linguist 01-18-2008 02:06 AM

Quote:

Originally Posted by xanx (Post 13664958)
All I want to do is change a URL that looks like this

/downloads/?dl_cat=3

to something like

/downloads/name-of-download/

I can't seem to get it to work :disgust

Use what everyone else said & dynamically add "name-of-download" as a part of url, so you'd have something like /downloads/3-name-of-download/. Take first # and forward that to /?dl_cat=3. If you're hell bent on that just having /name-of-download then you can do it in mysql and you'd have /?dl_cat=name-of-download and then you'd get id from the database. The first way is easier.


All times are GMT -7. The time now is 04:03 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123