Forum Moderators: phranque
<Directory "/usr/local/psa/home/vhosts/mydomain.com/httpdocs">
Options +FollowSymLinks +SymLinksIfOwnerMatch
RewriteEngine On
RewriteRule ^([^/\.]+)/?$ index.php?1=$1 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?1=$1&2=$2 [L]
</Directory>
[mydomain.com...] and [mydomain.com...] errors 404 instead of [mydomain.com...]
Error.log tells me this:
Fri Jan 14 17:08:31 2005] [error] [client 217.136.105.135] File does not exist:
/usr/local/psa/home/vhosts/mydomain.com/httpdocs/httpdocs, referer: [mydomain.com...]
How can I remove the extra /httpdocs? The hosting server is running Apache2 with Plesk 7.
[edited by: jdMorgan at 7:07 pm (utc) on Jan. 14, 2005]
[edit reason] Fixed side-scroll [/edit]
Welcome to WebmasterWorld!
It looks like you are missing the leading slash in the RewriteRule patterns:
<Directory "/usr/local/psa/home/vhosts/mydomain.com/httpdocs">
Options +FollowSymLinks +SymLinksIfOwnerMatch
RewriteEngine On
RewriteRule [b]^/[/b]([^/\.]+)/?$ /index.php?1=$1 [L]
RewriteRule [b]^/[/b]([^/\.]+)/([^/\.]+)/?$ /index.php?1=$1&2=$2 [L]
</Directory>
Jim
Well, since it it's a shared server I don't know if they can edit the Apache document_root
Here is the config for my domain:
AddType application/x-miva-compiled .mvc
AddType application/x-miva-compiled .mv
Action application/x-miva-compiled /cgi-bin/mivamvc/mivavm
<Directory "/usr/local/psa/home/vhosts/mydomain.com/cgi-bin">
Options ExecCGI
</Directory>
<Directory "/usr/local/psa/home/vhosts/mydomain.com/httpdocs">
Options +FollowSymLinks +SymLinksIfOwnerMatch
RewriteEngine On
RewriteRule ^([^/\.]+)/?$ index.php?1=$1 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?1=$1&2=$2 [L]
php_admin_value include_path "/usr/local/psa/home/vhosts/mydomain.com/httpdocs:."
php_admin_value open_basedir "/usr/local/psa/home/vhosts/mydomain.com/httpdocs:/tmp:/usr/local/bin:/usr/local/netpbm/bin"
AddDefaultCharset utf-8
</Directory>
If I put the rewrite rules in an .htaccess and test it on Apache at my home, the rules work perfectly even without the trailing slash at the beginning. Does this mean that it's surely a document_root problem? Can this be solved with RewriteBase?
This is a difference between using mod_rewrite in httpd.conf and using it in .htaccess. Remember that in an .htaccess context, the URL "seen" by RewriteRule is adjusted to indicate the current local URL-path. So, in directory "/", the slash is removed, and in subdirectory "/subdir/", the "/subdir/" will be removed from the URL "seen" by RewriteRule.
Try using RewriteBase, and let us know if it helps.
Jim