0

Trying to access a google file on the server which is at http://www.norland.co.uk/googled096ea11cba5b121.html

This is an ExpressionEngine build.

My htaccess rules as follows:

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

RewriteCond %{HTTP_HOST} ^www\.norland\.co\.uk$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/college$
RewriteCond %{REQUEST_URI} !^/(college|agency|norlanders|consultancy)/(.*)$
RewriteRule ^(.*)$ /college/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^www\.norland\.co\.uk$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

I would have thought the RewriteCond %{REQUEST_FILENAME} !-d rule would exclude this but for some reason requesting this is redirecting to http://www.norland.co.uk/college/403.shtml

The 'college' redirection I can understand but not a clue why it is

  • redirecting to /403.html
  • why the source file cannot be found when I can see it on the server

Help!?

2
  • It's probably not the issue here but please check the permissions of the html file. – Franz May 20 '15 at 8:18
  • Looks like @user1736 is probably right: the rewrite seems to be working (by not redirecting) but the server is throwing a 403 (forbidden) and EE is serving up the 403 template as a result. Check permissions etc. for the html file. – Wil May 20 '15 at 9:09
0

Presumably this is all of the htaccess rules? Nothing like the below preventing serving of HTML files entirely?

RewriteRule ^(.*)?\.html$ - [F,L]
0

Forgive me I havn't the time to disect your htaccess fully, however the -d rule is for directories, granted you have the -f file rule as well, I won't comment on why it's ignoring files however (one of the guys here will correct me if I'm wrong) I beleive .html is a declared html file extension according to apache therefor not caught by the -f, just like .php or .htm.

Why perform 2 sets of rules though when you can literally achieve what you want with one? I assume /collage/ needs to be appended in all cases (except the excempt paths) and that there's no actual www.norland.co.uk/collage links out there...

Here's a standard htaccess template I use, I've modified it to exclude requests to your google verification file and always add /collage/ unless the directory is within the exclusions :

    #Exclude file paths, directory paths
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$

    #file whitelist, do not rewrite if file is root & name is ...
    RewriteCond $1 !^(favicon\.ico|index\.php|path\.php|php\.ini|admin\.php|googled096ea11cba5b121.html) [NC]

    #directory whitelist, do not rewrite if path begines with ...
    RewriteCond $1 !^(system|sysbase|images|themes|css|assets)/ [NC]

    #Rewrite what needs rewriting
    RewriteRule ^(.*)$ /collage/index.php/$1 [L]

Of course, you can add your HTTP_HOST rule back in if you've got more than one URl going into the same root directory.

Might not work (so sorry I'm typing on the move so no ability to test), but should give you something to get your teath into!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.