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)
-   -   .htaccess mod_rewrite problem (https://gfy.com/showthread.php?t=965429)

V_RocKs 04-26-2010 03:27 PM

.htaccess mod_rewrite problem
 
I would like to set up a site where this happens:

http://www.domain.com/ => loads index normally
http://www.domain.com/this-subdirectory/ => index.php?id=this-subdirectory
http://www.domain.com/anothersub/ => index.php?id=anothersub
http://www.domain.com/whatever/you/put => index.php?=whatever/you/put

I tried various ways of doing it and either ended up in a loop or it didn't work at all. If I used something like /this_never_changes/(+.) I could easily pass the variable, but I need the variable to be the subdirectories themselves.

fatfoo 04-26-2010 03:30 PM

My suggestion is talk to your host support. I chose justhost.com and they have live support that helped me with my .htaccess issues.

KickAssJesse 04-26-2010 03:32 PM

Try this :]

RewriteEngine on
RewriteRule /(.*)/ index.php?id=$1

V_RocKs 04-26-2010 03:47 PM

The requested URL /google/ was not found on this server.

V_RocKs 04-26-2010 03:58 PM

This seems to do what I need.

Congrats to all of the winners!

Code:

RewriteRule ^([A-Za-z0-9-]+)/$ index.php?id=$1 [L,NC]

StariaDaniel 04-26-2010 04:03 PM

Quote:

Originally Posted by KickAssJesse (Post 17076799)
RewriteRule /(.*)/ index.php?id=$1

Quote:

Originally Posted by V_RocKs (Post 17076885)
RewriteRule ^([A-Za-z0-9-]+)/$ index.php?id=$1 [L,NC]

You can do it by just adjusting the pattern to "everything except for /"

Like:
Code:

RewriteRule ^/([^/]+)/?$ /index.php?id=$1 [L,NC]

fris 04-26-2010 05:19 PM

regex nazis


All times are GMT -7. The time now is 12:28 AM.

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