I am using MAMP to host a website.
I have index.html and index.php both inside a folder.
How can I make web server open index.html instead of index.php
THanks.
Make sure you configure the right order of DirectoryIndex.
Related
After moving the rootDirectory of apache2 from
/var/www/html
to
/var/www/html/MyFolder
because I didn't want my website to be "www.website.de/MyFolder"
but now I have to type in "www.website.de/index.php" (that works)
What do I have to change so I can just type in "www.website.de" and the index.php is displayed automatically
I didn't change much. Only the rootDirectory 000-default.conf.
Add this:
DirectoryIndex index.php index.html index.htm
Or just:
DirectoryIndex index.php
If you don't care about index.html and index.htm being possible alternatives.
This tells Apache which files should be served from a directory when no file is specified, in order of priority.
Perhaps put it in a .htaccess file in MyFolder.
I had changed the DNS Nameservers recently but my browser is still redirecting me to the old DNS servers. I found that out because on my phone everything is working perfectly.
I tried everything - from clearing browser cache to ipconfig /flushdns but nothing worked until now - maybe somebody has an idea how I can fix this problem on my machine?
I've created a new domain and setup a php application on the webroot. All the following requests are working perfectly.
/index.php
/info.php
/?anyting ( Note this, without index.php only query string is working )
/css/app.css
Only the domain's root is not working domian.in
I have created an virtual host for the domain. I tried giving DirectoryIndex index.php also, but still it's not working. There is no htaccess and it's a fresh server setup.
Googled whatever was possible, couldn't get any solution.
And if i hit domain.in it's serving the apache's default page.
If you have an virtual host you cant acces files outside the document root.
Maybe your html files (or others) are in a htdocs folder or something, you cant access htdocs/../
I'd like to change the page that is shown when a directory doesn't have an index.php/html page.
I made a php page that I'd like to use, but I don't know how to set it as a default. I don't want to copy the file into every single directory.
Is this even possible?
You can configure this is the httpd.conf under the DirectoryListings setting
http://wiki.apache.org/httpd/DirectoryListings
DirectoryIndex yourpage.php index.html index.htm index.php welcome.html
Here is the folder layout.
/outside is not normally accessible anywhere on example.com
/public_html is the folder for http://example.com
How can I use Apache's htaccess to make the url http://example.com/outside/ to show content from the folder /outside?
Thanks!
How can I use Apache's htaccess to make the url http://example.com/outside/ to show content from the folder /outside?
You can't. As far as I have found out, Apache prevents directives in .htaccess files linking to locations outside the current web root.
You would have to do this in the central configuration:
Alias /outside /path/to/your/outside
You may be luckier with a symlink if you can turn FollowSymLinks on.
I have not done any web dev before. I got my Apache server running on mac OS X, and set up a virtual host at /Users/dan/webapps. So, when I go to http://localhost/ in my browser, my index.html in the webapps folder shows up, as expected.
I then created Users/dan/webapps/temp/ folder, and put a flash app in there, let's call it "test.html", along with the required "test.swf". I restart the server. However, when i put http://localhost/temp into my browser, I get File Not Found. How do I make the browser able to go to that directory, and when it goes there, have it start test.html. I am using Safari. Thanks.
you should type: http://localhost/temp/test.html
a full path to your page,
Or you can change the name of your page from test.html to index.html and it would be loaded when you enter http://localhost/temp/, since the default DirectoryIndex is index.htm or index.html
Create a .htaccess file in Users/dan/webapps/temp/, and add the line:
DirectoryIndex test.html
This will make apache look for test.html when someone accesses the directory. Make sure permissions/ownership allows your webserver to read this file.