GIDForums  

Go Back   GIDForums > Web Hosting Forums > Apache Web Server Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 14-Nov-2005, 16:33
ubergeek ubergeek is offline
Regular Member
 
Join Date: Jan 2005
Posts: 775
ubergeek is a jewel in the roughubergeek is a jewel in the roughubergeek is a jewel in the rough

mod_rewrite


On my website, there are folders for each of MLB, NFL, NBA, and NHL at, respectively, /sports/mlb/, /sports/nfl/, etc. I want those to be available even if you type in by mistake just /mlb/ or /nfl/ etc. So I tried the following in .htaccess:
Code:
RewriteEngine On ... RewriteRule ^/(mlb|nfl|nba|nhl)(.*)$ /sports/$1$2 [R]
What I (apparently incorrectly) thought this would do was catch /mlb/anything, /nfl/anything, and redirect to /sports/mlb/anything. The [R] is just there so I could see what was happening, as it didn't work. Can anyone see what I'm doing wrong? Thanks.
  #2  
Old 15-Nov-2005, 00:56
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough

Re: mod_rewrite


Is /sports/ an actual directory/folder or is it fake?

My mod-rewrite knowledge is now rusty, haven't used it in a while but try this:

Code:
RewriteEngine on RewriteBase / RewriteRule ^(mlb|nfl|nba|nhl)(.*) /sports/$1$2 [R=301,L]

I will appreciate your feedback.
  #3  
Old 15-Nov-2005, 14:12
ubergeek ubergeek is offline
Regular Member
 
Join Date: Jan 2005
Posts: 775
ubergeek is a jewel in the roughubergeek is a jewel in the roughubergeek is a jewel in the rough

Re: mod_rewrite


the /sports/ directory is, indeed, real. it's the /mlb/, /nfl/, etc directories i'm trying to fake

The code you gave does not, unfortunately, work. Including the RewriteBase directive in .htaccess makes nothing load at all except the site's background, which is very odd indeed. But even taking that out, when I try /mlb the browser tries to connect to in-diffusion.agava.com (?). This server never replies (firefox always times out), even though it has an entry in whois.net. I do not own the server for my site, nor do I pay for it; I use Siteburg.com's free web hosting. I suppose I'm getting what I pay for, but this is mystifying. I have other, simple, redirects in .htaccess to preserve old links to moved files, that work fine.
 

Recent GIDBlogPrepping for deployment by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 21:52.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.