Mobile app version of vmapp.org
Login or Join
Jennifer507

: PHP webpages in sub-directory cannot be accessed I've got a university club website at thing.uni.ac.uk/meow/foobar which also has the domain foobar.co.uk. I don't have access to the config. I set

@Jennifer507

Posted in: #Apache #Htaccess #HttpCode500 #Php

I've got a university club website at thing.uni.ac.uk/meow/foobar which also has the domain foobar.co.uk. I don't have access to the config. I set up this website using HTML/CSS/JS alone and it's been fine, but now I've started learning PHP and I'm trying to switch to .php pages instead of .html pages.

When debugging the problem I'm about to describe, I made a page.php file and a page.html file that are identical (a simple hello world without any PHP tags). The problem I face is that if I try to go to foobar.co.uk/alpha/example/page.php, I get the following Internal Server Error:


/www/htdocs/meow/foobar/alpha/example is not owned by group g_www_bar_meow_foobar or any other acceptable groups.


But if I go to foobar.co.uk/alpha/example/page.html, it works fine. If I try to go to the non-existent foobar.co.uk/alpha/example/badger.php it gives me the 404 page as I would expect. If I move page.php to foobar.co.uk/alpha/page.php then it works.

Update

I've checked the permissions of page.php that isn't in the offending directory compared to page.php that is, and both seem to have the same permissions:





I'm not sure this has anything to with the problem, but I have a htaccess file in the foobar.co.uk/ directory which contains:
#redirect from the other domain to foobar.co.uk
RewriteCond %{HTTP_HOST} !^(www.)?foobar.co.uk$ [NC]
RewriteRule ^(.*)$ foobar.co.uk/ [R=302,L]
#remove trailing slash if not a directory
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ / [R=301,L]
#301 from example.com/page.html to example.com/page
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /.*.html HTTP/
RewriteRule ^(.*).html$ / [R=301,L]

#example.com/page will display the contents of example.com/page.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ .html [L,QSA]


(This is only the part which I think could be relevant) But this should only do rewrites for html files.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Jennifer507

1 Comments

Sorted by latest first Latest Oldest Best

 

@XinRu657

What if you use php only as a container and include an html page in it? This would by the way be a good way to re-use html code.

For instance you have the contents in an html file called example.htm and in the php file you write:

<?php
include('example.htm');
?>

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme