Forum Moderators: phranque
I'm having that damned 403 error...
I have enabled this in a virtual host:
<Directory "/home/*/site/system">
Option +FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride All
Order allow,deny
Allow from all
</Directory>
I'm 9999999% sure that the directory path is absolutely correct.
As you see I've set +FollowSymLinks and +SymLinksIfOwnerMatch like it should be, but in the error log apache still screams "[Mon Aug 04 20:03:06 2008] [error] [client 192.168.1.12] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /home/*/site/system/lo/test.html
" and points me to a 403 Forbidden error....
Sorry but I forgot to add the .htaccess rewrite rules I've added
Options +FollowSymLinks +Indexes
RewriteEngine On
RewriteBase /lo/
RewriteRule ^test.html$ test.php [L]
So I have the real file "test.php" and I want to be able to access it via test.html. "/lo/" is a sub-directory of the main site ( I'm using it for testing )
Any suggestions ?
Thanks in advance,
tftd
[edited by: tftd at 6:02 pm (utc) on Aug. 4, 2008]
I'm having that damned 403 error...
I have enabled this in a virtual host:
<Directory "/home/*/site/system">
Option +FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride All
Order allow,deny
Allow from all
</Directory>
I'm 9999999% sure that the directory path is absolutely correct.
As you see I've set +FollowSymLinks and +SymLinksIfOwnerMatch like it should be, but in the error log apache still screams "[Mon Aug 04 20:03:06 2008] [error] [client 192.168.1.12] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /home/*/site/system/lo/test.html
" and points me to a 403 Forbidden error....
Sorry but I forgot to add the .htaccess rewrite rules I've added
Options +FollowSymLinks +Indexes
RewriteEngine On
RewriteBase /lo/
RewriteRule ^test.html$ test.php [L]
So I have the real file "test.php" and I want to be able to access it via test.html. "/lo/" is a sub-directory of the main site ( I'm using it for testing )
Any suggestions ?
Thanks in advance,
tftd
Hm... strange ... double post ?
The absence of a correct Options directive in the config file or in a .htaccess file will result in a 500-Server Error, but getting a 403-Forbidden --instead of, or in addition to-- the 500 Error indicates a secondary problem. Check your 500- and 403- ErrorDocument URL-paths and permissions carefully.
It is necessary to set FollowSymLinks or SymLinksIfOwnerMatch, but not both, in order to use mod_rewrite.
If either of these is set in the server config for a site's directory space, then it is not necessary to set it in the .htaccess file(s) in that directory. In fact, since you've set it in the config, you might want to review your AllowOverride with an eye to security.
Jim
Now I'm wondering how could I redirect all of my images...
I have a IPB (Invision Power Board) forum and I'm trying to make it SEO.
These are some links on the forum:
http://forum.example.com/showforum/3 which refers to http://forum.example.com/index.php?showforum=3
The person who made the style entered all of the images with path "style_images/<skin_id>/someimage.jpg" where skin_id is the actual skin id in the database. And as you can see when you enter http://forum.example.com/showforum/3 all of the images will be considered to be http://forum.example.com/showforum/3/style_images/<skin_id>/someimage.jpg....
I've done this in the .htaccess
RewriteEngine On
RewriteBase /
RewriteRule ^showforum/([0-9]+)$ index.php?showforum=$1 [NC]
RewriteRule ^test.html$ test.php [NC]
RewriteRule ^showforum/([0-9]+)/style_images/(.+)/(.+)$ http://forum.example.com/style_images/$1/$2 [NC]
Which works just fine if you enter
http://forum.example.com/showforum/3/style_images/<skin_id>/logo4.gif
but it's not working in a <img src=""> tag...
I've read about this somewhere but .. I can't remember it...
[edited by: jdMorgan at 8:47 pm (utc) on Aug. 4, 2008]
[edit reason] example.com [/edit]
So, you have two choices: Re-code those page-relative links to server-relative links (i.e. add a leading slash and the full URL-path to the image directory), or specifically rewrite client-requested image URLs to the proper server filepath. (To explain, you have essentially inserted "virtual directory levels" into your new URLs, and the browser takes your word for it, and resolves the page-relative image URLs according to those virtual directory levels.)
I recommend the first option: Re-code your on-page <img src> links. The second method should only be used if there is no possible way to re-code the links. The reason for this is simple: In order to correct the links, the code will have to 'drop' part of the URL-path. Unless you specifically check those dropped path-parts for validity, the result of ignoring them is that you effectively create an infinite number of valid URLs for each image. This can result in image-search problems if erroneous links are introduced, either accidentally or maliciously.
Jim
RewriteEngine On
RewriteBase /
RewriteRule ^showforum/([0-9]+)$ index.php?showforum=$1 [NC]
RewriteRule ^test.html$ test.php [NC]
RewriteRule ^showforum/style_images/(.*)$ http://forum.example.com/style_images/$1 [NC]
RewriteRule ^showforum/([0-9]+)/style_images/(.+)/(.+)$ http://forum.example.com/style_images/$2/$3 [NC]
Everything seems to be working like that.
Thanks again for helping me ! :)
[edited by: jdMorgan at 8:54 pm (utc) on Aug. 4, 2008]
[edit reason] example.com [/edit]
RewriteRule ^showforum/([0-9]+)/style_images/([^/]+)/([^/]+)$ http://forum.example.com/style_images/$1/$2 [NC,L]
Use the [L] flag on every rule to improve efficiency, unless you know a specific reason why you do not wish to do so on a particular rule.
I also recommend that you drop the [NC] flag, as this also results in multiple URLs per image. Redirect any URLs with case errors to the correct URL if you can, rather than allowing any-case URLs to be used.
Jim