0

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 is below:

# turn on Rewrite
RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www.)?cobweb.seas.gwu.edu/~mpnl$
RewriteCond %{REQUEST_URI} !^/joomla/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /joomla/$1 [L]

RewriteRule ^(/)?$ joomla/index.php [L]
Sean Bright
  • 118,630
  • 17
  • 138
  • 146

2 Answers2

0

You can't match against the URI path with the %{HTTP_HOST} var, only the host. You'll need to either include the ~mpnl part as a rewrite base or as part of the request URI:

RewriteEngine on

# remove the "/~mpnl" from the end of this line, add a [NC]
RewriteCond %{HTTP_HOST} ^(www.)?cobweb.seas.gwu.edu$ [NC]
# add a "/~mpnl" to here
RewriteCond %{REQUEST_URI} !^/~mpnl/joomla/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# remove the leading slash before "joomla"
RewriteRule ^(.*)$ joomla/$1 [L]

# add a condition to this:
RewriteCond %{REQUEST_URI} !^/~mpnl/joomla/
RewriteRule ^(/)?$ joomla/index.php [L]
Jon Lin
  • 142,182
  • 29
  • 220
  • 220
  • I tried your suggested (.htaccess) file without success- still getting the same 500 Internal Server error. I double-checked and mod_rewrite is enabled on the server.I used textedit to edit the file, ensured the file was saved for unix, and ansi encoding. Also tried various permissions. I should mentioned I saved the (.htaccess) file to the root of public_html. – Kirk Woellert Sep 02 '12 at 13:36
0

To rewrite requests with a UserDir in the URI, you have to set a RewriteBase:

RewriteBase /~mpnl/
CIRCLE
  • 4,501
  • 5
  • 37
  • 56