Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

(.htaccess) how to mod_rewrite a tilde user site to subfolder within same site

Status
Not open for further replies.

kdwoell

Technical User
Aug 24, 2012
3
0
0
US
I have been working this issue for several nights with no luck. I'm trying to Rewrite web requests using (.htaccess)
from: cobweb.seas.gwu.edu/~mpnl
to: cobweb.seas.gwu.edu/~mpnl/joomla

My latest (.htaccess) file below returns a 500 Internal Server Error:

Code:
# turn on Rewrite
RewriteEngine on

RewriteCond %{HTTP_HOST} ^([URL unfurl="true"]www.)?cobweb.seas.gwu.edu/~mpnl$[/URL]
RewriteCond %{REQUEST_URI} !^/joomla/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /joomla/$1 [L]

RewriteRule ^(/)?$ joomla/index.php [L]

Sure appreciate some pointers on what is wrong with this code.
 
I should clarify I'm the webmaster for this site, not the web administrator. I don't have access to the Apache server configuration.
 
Ok! So you will have to ask the server admins to edit the VirtualHost entry in httpd.conf for that user account which they probably will not want to do, because having one vhost setup differently could "break" at a later date under some circumstances.

OR
Ask for that user account to be excluded from mod_userdir so servername/~ or IP/~ will no longer work.
OR
Catch the HTTP_HOST on every URL request using sever side code, append /joomla and redirect on a ~username match.
OR
Tell the user to append /joomla/ to the user directory URL
OR
Live with it.


Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
"Ok! So you will have to ask the server admins to edit the VirtualHost entry in httpd.conf for that user account which they probably will not want to do, because having one vhost setup differently could "break" at a later date under some circumstances.

OR
Ask for that user account to be excluded from mod_userdir so servername/~ or IP/~ will no longer work.
OR
Catch the HTTP_HOST on every URL request using sever side code, append /joomla and redirect on a ~username match.
OR
Tell the user to append /joomla/ to the user directory URL
OR
Live with it."


Might you clarify on a couple of your options?

1. Edit VirtualHost entry in httpd.conf. What might cause the user account in question to "break" at a later date?

2. For, "Catch the HTTP_HOST" option, do you mean using mod_rewrite rules in an (.htaccess) file? If so, would this work?

Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([URL unfurl="true"]www.)?cobweb.seas.gwu.edu$[/URL] [NC]

RewriteCond %{REQUEST_URI} !^/~mpnl/joomla/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ joomla/$1 [L]

RewriteCond %{REQUEST_URI} !^/~mpnl/joomla/
RewriteRule ^(/)?$ joomla/index.php [L]
 
What might cause the user account in question to "break" at a later date?
I have no idea, as I don't know what scripts they have for backing up, backup scripts, malware scaning, AV scanning etc. etc. I only know what would break on my servers.

For, "Catch the HTTP_HOST" option, do you mean using mod_rewrite rules in an (.htaccess) file? If so, would this work?

No I mean using server-side code such as PHP or Perl.






Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top