jdubwelch Posted October 2, 2010 Share Posted October 2, 2010 I used to have many many (like 90 redirects). But that crashed the server. So I need to figure out a new way to do this. My old redirects is this: <IfModule mod_rewrite.c> # Enable mod_rewrite RewriteEngine On # Permalinks# Rewrite Rules for OregonRewriteRule ^NCAA/Pac-10/Oregon-Ducks/$ index.php?teamID=1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/page/([0-9]+)/ index.php?teamID=1&page=$1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/category/([0-9])/.*/page/([0-9])/ categories.php?teamID=1&catID=$1&page=$2RewriteRule ^NCAA/Pac-10/Oregon-Ducks/category/([0-9]+)/ categories.php?teamID=1&catID=$1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/source/([0-9]+)/.*/page/([0-9])/ sources.php?teamID=1&sourceID=$1&page=$2RewriteRule ^NCAA/Pac-10/Oregon-Ducks/source/([0-9]+)/ sources.php?teamID=1&sourceID=$1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/date/([0-9]{4}\-[0-9]{2}\-[0-9]{2})/.*/page/([0-9])/ date.php?teamID=1&date=$1&page=$2RewriteRule ^NCAA/Pac-10/Oregon-Ducks/date/([0-9]{4}\-[0-9]{2}\-[0-9]{2})/ date.php?teamID=1&date=$1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/popular/page/([0-9]+)/ popular.php?teamID=1&page=$1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/popular/ popular.php?teamID=1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/contribute/ contribute.php?teamID=1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/contribute-feed/ contributeFeed.php?teamID=1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/m mobile.php?teamID=1RewriteRule ^NCAA/Pac-10/Oregon-Ducks/([0-9]+)/ headline.php?teamID=1&id=$1... times 90 (one set for each team) ...</IfModule> As you can see there a "dummy" folder structure /NCAA/Pac-10/Oregon-Ducks that is loading the root directory file index.php?teamID=1 I'm told by my server admins that I can't have that many in one htaccess file, So i'm trying to figure a way around this. I was thinking of creating the folder structure for each team and having the htaccess file in that folder creating the redirects back to the root directory. But I don't know how to do that. i tried: <IfModule mod_rewrite.c> # Enable mod_rewrite RewriteEngine On# Rewrite Rules for OregonRewriteRule ^NCAA/Pac-10/Oregon-Ducks/$ ../../../index.php?teamID=1 # End Permalinks</IfModule> but that didn't work. Here's the structure if it helps: php_value include_path ".:/Applications/MAMP/htdocs/projects/oneclicksportsnow/trunk/html/" Inside /html/ are all my working files that read in and display dynamic data based on teamID (ie index.php, categories.php, sources.php, etc) I then would have: /html/NCAA/Pac-10/Oregon-Ducks/.htaccess Directing everything back to the root. Quote Link to comment https://forums.phpfreaks.com/topic/214964-how-to-do-this-backwards/ Share on other sites More sharing options...
cags Posted October 2, 2010 Share Posted October 2, 2010 I've seen/answered this same question before. Why statically declare 'NCAA/Pac-10/Oregon-Ducks' and hard code the teamID, capture the Oregon-Ducks part and use it at the top of your scripts to fetch teamID. Alternatively use the 'Oregon-Ducks' value as a unique ID for fetching the other data, instead of teamID. Same would be true of NCAA and Pac-10 only you don't seems to actually use those values in the script. Quote Link to comment https://forums.phpfreaks.com/topic/214964-how-to-do-this-backwards/#findComment-1118252 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.