Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 8th, 2002, 07:21 PM
elysium elysium is offline
Gentleman of leisure
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: Sweden
Posts: 44 elysium User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 31 m
Reputation Power: 7
Mod_rewrite question, I think.

Is it possible to (rewrite and) forward, a request like http://domain.com/~something/ to http://domain.com/somethingelse/something/
You don't have to give me any pretty code, I like finding out on my own. But it's nice to know if it's possible or not.

Reply With Quote
  #2  
Old February 8th, 2002, 09:00 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yes and it works with both internal/external redirect.

Reply With Quote
  #3  
Old February 9th, 2002, 06:23 AM
elysium elysium is offline
Gentleman of leisure
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: Sweden
Posts: 44 elysium User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 31 m
Reputation Power: 7
Okay, thanks.
Now I've used:

RewriteEngine on
RewriteRule ^/~(.+) http://domain/usr/$1 [R,L]

But e.g. http://domain/~apa doesn't redirect to http://domain/usr/apa
mod_rewrite IS loaded, but no errormsgs.

Any idea?

Reply With Quote
  #4  
Old February 9th, 2002, 08:54 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> doesn't redirect to http://domain/usr/apa

Can you access http://domain/user/apa/ directly?

Your rulesets look absolutely fine. The question is how you handle UserDir.
BTW you don't even need to use /~apa at all.

If you need internal redirect, just change your ruleset to:

RewriteEngine on
RewriteRule ^/~(.+) /server/path/usr/$1 [L]

Reply With Quote
  #5  
Old February 27th, 2002, 07:32 PM
elysium elysium is offline
Gentleman of leisure
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: Sweden
Posts: 44 elysium User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 31 m
Reputation Power: 7
Now I had some time over and thought I'd give it a go again. Rewrote it to use internal redirect instead;
RewriteRule ^/~(.+) /usr/local/www/burkmatnu/www/usr/$1 [L]
where /usr/local/www/burkmatnu/www/ is the absolute path to the public www. Still doesn't work though. Have I missed something really simple and that's why it wont work? I've put the lines in a htaccess-file in the www-root; could that be the problem?

Reply With Quote
  #6  
Old February 28th, 2002, 02:14 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You still haven't replied to my previous question.

>> I've put the lines in a htaccess-file in the www-root

Don't even do that, just put that in httpd.conf within <Directory "/usr/local/www/burkmatnu/www">

Reply With Quote
  #7  
Old February 28th, 2002, 08:12 AM
elysium elysium is offline
Gentleman of leisure
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: Sweden
Posts: 44 elysium User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 31 m
Reputation Power: 7
If the question was "Can you access http://domain/user/apa/ directly?" Then it's 'yes'. If it was "how you handle UserDir", then I have no idea. It's not my server, so I don't have access to httpd.conf. It [the mod_rewrite] works great at home, but since I'm on dialup I can't really run a 24/7 website on it.

Reply With Quote
  #8  
Old February 28th, 2002, 01:54 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> If it was "how you handle UserDir", then I have no idea. It's not my server

Then you can't do it in .htaccess because UserDir is not overridable. You can't use mod_rewrite to intercept the ^/~username/ URI when UserDir is enabled.

There would be a serious security flaw when you do this in .htaccess:

RewriteEngine on
RewriteRule ^/~(.+) /server/path/usr/$1 [L]

where the (.+) is another user's docroot that now lives under your docroot with a -Indexes.

Last edited by freebsd : February 28th, 2002 at 01:58 PM.

Reply With Quote
  #9  
Old February 28th, 2002, 02:46 PM
elysium elysium is offline
Gentleman of leisure
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: Sweden
Posts: 44 elysium User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 31 m
Reputation Power: 7
Okay, I understand that would be a huge security flaw. Thanks for pointing it out.
Am I to understand that if one would use external redirects in .htaccess instead, the flaw would sieze to exist? Or am I just being foolish?

Reply With Quote
  #10  
Old February 28th, 2002, 03:36 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
External is a little safer though. But really, you need to disable UserDir or change UserDir to a URI other than ^/~username/ else you can't override it.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Mod_rewrite question, I think.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway