The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > Filesystems, Disks and Memory
Google UNIX.COM


Filesystems, Disks and Memory Questions involving NAS, SAN, RAID, Robotic Libraries, backups, etc go here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Symlinks ct1977 UNIX for Dummies Questions & Answers 1 02-21-2008 03:15 PM
Nested Symlinks? deckard Shell Programming and Scripting 0 09-07-2007 12:07 PM
search and replace symlinks nixrock UNIX for Advanced & Expert Users 2 10-19-2005 02:25 PM
.htaccess Avenger UNIX for Dummies Questions & Answers 3 04-12-2002 08:49 AM
.htaccess? Puc conDoin UNIX for Dummies Questions & Answers 1 05-28-2001 05:58 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #22  
Old 10-01-2007
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,588
add this line to turn on max verbosity on rewrites.
Code:
RewriteLogLevel 9
Reply With Quote
Forum Sponsor
  #23  
Old 10-01-2007
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,588
Quote:
Originally Posted by ukndoit View Post
It still does not work, I can load pages with http://www.mydom.com/web/usernamehere/filename.html
that does work, but images will not show, I get placeholder spots with red x's in them...
You probably have absolute paths for images, and these are getting redirected incorrectly. It very hard to tell without seeing what is happening, but you could grab the properties of the missing images to get what path it is trying to load them from and see if that has been incorrectly rewritten.
Reply With Quote
  #24  
Old 10-01-2007
Registered User
 

Join Date: Sep 2007
Posts: 19
Thumbs up It worked!!


I GOT IT TO WORK!!! SWEET, but please tell me if you see a glitch in this:

Code:
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !^/web/(.*)
RewriteCond   /home/path/to/public_html/%{REQUEST_FILENAME} !-f
RewriteCond   /home/path/to/public_html/%{REQUEST_FILENAME} !-d
RewriteRule ^(.+) http://www.ourdomain.com/web$1 [R]
When I visit http://www.ourdomain.com/username it redirects to
http://www.ourdomain.com/web/username and everything loads just fine!!
when I go to http://www.ourdomain.com/css it loads the index of the css just fine but the images still do not show on there, but they do if I just go the main domain so I don't care.
however, when I go to http://www.ourdomain.com/images
I get redirected to http://www.ourdomain.com/web/403.shtml
lol, I don't know why that happens, but could it be because images is a symlink to the main websites images directory??
I don't know.
But anyhow do you see any glitches or a way that could be broken?

thank you so much for ALL your help.
I could not have done it without you.
Richard



Quote:
Originally Posted by reborg View Post
You probably have absolute paths for images, and these are getting redirected incorrectly. It very hard to tell without seeing what is happening, but you could grab the properties of the missing images to get what path it is trying to load them from and see if that has been incorrectly rewritten.
Reply With Quote
  #25  
Old 10-01-2007
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,588
It is in fact bacuse of the symlink:

Code:
RewriteCond %{REQUEST_FILENAME} !^/web
RewriteCond   /home/path/to/public_html/%{REQUEST_FILENAME} !-f
RewriteCond   /home/path/to/public_html/%{REQUEST_FILENAME} !-d
RewriteCond   /home/path/to/public_html/%{REQUEST_FILENAME} !-l
RewriteRule ^(.+) http://www.ourdomain.com/web$1 [R]
It's not the most elegant of solutions, (try REQUEST_URI ) , and you donr't need http://www.ourdomain.com in the redirect.
Reply With Quote
  #26  
Old 10-01-2007
Registered User
 

Join Date: Sep 2007
Posts: 19
Yeah, at first I did not put the domain name in there and it redirected them to http://mydomain.com/web/username
instead of the http://www.mydomain.com/web/username

I guess it does not matter if it has www. or not, but the secure pages do, because we have the ssl cert setup as www.domain.com not just domain.com.

Thanks again for everything.
Richard


Quote:
Originally Posted by reborg View Post
It is in fact bacuse of the symlink:

Code:
RewriteCond %{REQUEST_FILENAME} !^/web
RewriteCond   /home/path/to/public_html/%{REQUEST_FILENAME} !-f
RewriteCond   /home/path/to/public_html/%{REQUEST_FILENAME} !-d
RewriteCond   /home/path/to/public_html/%{REQUEST_FILENAME} !-l
RewriteRule ^(.+) http://www.ourdomain.com/web$1 [R]
It's not the most elegant of solutions, (try REQUEST_URI ) , and you donr't need http://www.ourdomain.com in the redirect.
Reply With Quote
  #27  
Old 10-01-2007
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,588
That should be your first redirection rule in that case.

Code:
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteRule (.*) http://www.mydomain.com/$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !^/web
RewriteCond   /home/path/to/public_html/%{REQUEST_FILENAME} !-f
RewriteCond   /home/path/to/public_html/%{REQUEST_FILENAME} !-d
RewriteCond   /home/path/to/public_html/%{REQUEST_FILENAME} !-l
RewriteRule ^(.+)  /web$1
Reply With Quote
  #28  
Old 10-06-2007
Registered User
 

Join Date: Sep 2007
Posts: 19
Quote:
Originally Posted by reborg View Post
That should be your first redirection rule in that case.

Code:
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteRule (.*) http://www.mydomain.com/$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !^/web
RewriteCond   /home/path/to/public_html/%{REQUEST_FILENAME} !-f
RewriteCond   /home/path/to/public_html/%{REQUEST_FILENAME} !-d
RewriteCond   /home/path/to/public_html/%{REQUEST_FILENAME} !-l
RewriteRule ^(.+)  /web$1
Thank you for all the help. I have one more question, I see that mod_rewrite can even check a database, but I don't see a way to do that.

How can I check the database on the fly to see if a username is even legit and redirect only if it is, and otherwise redirect somewhere else?

Do you know where I can see an example of this?

I'd really appreciate it.
I am totally in love with this mod_rewrite, I cannot believe how much better it is then using .htaccess PER USER!! Wow, what power!

Thank you so very very much.
Richard
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:58 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0