EasyPHP default load page - php

I've noticed that when I access local web the default index.php file in the www folder doesn't show, and when I open a folder it automatically opens the file with name index.html, anyone knows why that is happening? (I'm using EasyPHP 1.8 because it's the version we're using in high school).
Thanks!

It depends on the web server configuration you're using.
Set in apache2 configuration file (for example in Ubuntu 16.04 /etc/apache2/apache2.conf) or in .htaccess file (that will give priority to .php file over .html file):
DirectoryIndex index.php index.html index.htm
or simply:
DirectoryIndex index.php

Related

NGINX + mediawiki: Setting a index.html on top of index.php (index priority)

I am trying to set a index.html file to be on top of my mediawiki installation. I could set it to the logo link at the header but I am having trouble setting the domain to point to that index.html instead of the default index.php mediawiki comes with. On a Apache server I could easily set a .htaccess at mediawiki's root folder, but since I am using NGINX that doesn't work.
I tried to set a "index index.html index.php;" on a location block in the .conf file but it is not working.
There were nothing wrong with the directive I was using. However, the server running NGINX had another set of configurations for the same site in a different folder that I was unaware of. So if you are facing the same problem, double check the folder "sites-available" or any other folder under /etc/nginx/.

Webiste url are not routing without index.php

I uploaded my website from my UAT/Test domain to EC2 AWS. Before everything was fine, but now only home page opens.
And if I try to navigate to any other links I can't, it gives following error
The requested URL /page/company was not found on this server.
But when I insert index.php in between it works fine.
Any ideas?
Please enable mod_rewrite module in your server and rewrite index.php in htaccess file.
Please check your file premissions
I believe the issue could be DirectoryIndex which apache (not positive that is what you are using as web server) uses to direct the user to a specific file if a directory is selected in the URL.
This can be set in your apache config if you have access, or in a .htaccess file if you only have access to the your webspace itself.
http://www.htaccess-guide.com/directoryindex-uses/
Basically with DirectoryIndex you can tell apache to automatically use index.php, or index.html, or really whatever file you want to be used when no file in a directory is given in the URL.

Open website in browser directly when http://localhost is input

I am using xampp and i have a website in htdocs.
The home page home.html is in a folder website -> website/home.html. I want to host that website in xampp, so my question is, how to access the home page home.html directly.
Is there any modification that need to be done?
You'll just have to move your home.html to the htdocs folder (just simple move it outside your website folder) and then make sure to rename it as index.html.
Since index.(php/html) would be automatically be opened once you access your localhost.
But take note this will replace the XAMPP's default index page which is not a problem (unless you want to make use of it).
Are you saying that you want home.html to open as the default page when browsing to http://localhost? If so, you'll want to add home.html as a Directory Index file. In standard Apache HTTPD server configuration, you'd just look for a block looking like:
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
Just add home.html to the end of the DirectoryIndex line, so you'd get:
<IfModule dir_module>
DirectoryIndex index.html index.php home.html
</IfModule>
The location of your httpd.conf file, where you'll need to make this change, depends on your XAMPP installation.
If this is not your question, you'll need to provide more specifics.
Although it might be preferable to change virtual hosts, a simpler solution would be to use an HTML Redirect. Create, in the htdocs folder, an index.html file with this line in it
<meta HTTP-EQUIV="Refresh" CONTENT="0; URL=http://localhost/website/home.html">
(assuming that localhost is reachable and the structure of the directory is htdocs/website/home.html)

how to move a apache localhost website to internet (i.e remote server)

i have few conceptual queries about moving a locahost site to server for making it available on internet.....what are the steps...how server will recognize the changes in my apache and php config files..i have built a website in php and mysql on apache 2.2
NOTES:
i have made some changes in my apache config files.one of them is i
have included a fillename "index.php" in
"DirectoryIndex"...so now my DirectoryIndex looks like:
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
so now automatically my apache tells the browser to search for a index.php file whenever header('LOCATION:') or refresh is called.and it's obvious that my index.php files holdas the html and and other php codes which will be shown or displayed
third and most importantly...i have used header function in many cases while building the website..my header functions are like header('Location: http://localhost/home/');
so repeating the question again
should i change all the header functions while uploading acording to my website name
i.e
header('Location: http://www.my_site_name.com/home/'); in place of
header('Location: http://localhost/home/');
and who will my remote server will recognize the changes i have made in my config file and will work according to the changes
and what are the steps to upload a website to internet
and who will my remote server will recognize the changes i have made
in my config file and will work according to the changes
Normally hosting servers are configured to allow the use of .htaccess files to override apache configuration
you may create a .htaccess file in your root directory and place there your DirectoryIndex settings
should i change all the header functions while uploading acording to
my website name i.e header('Location: http://www.my_site_name.com/home/');
in place of header('Location: http://localhost/home/');
Why not using relative paths or simply:
header('Location: /home/');
and who will my remote server will recognize the changes i have made
in my config file and will work according to the changes
That way, it'll work on both servers.
and what are the steps to upload a website to internet
You should use a FTP client to upload your website to your webhost.

Default file for Apache localhost

I have apache2 installed. When i type http://localhost it goes to a file http://localhost/class/index.php . How do i change it to say http://localhost/index.html or any other page? Which file will I find the setting to do this? Thanks!
Find the DirectoryIndex directive in your Apache configuration file (httpd.conf) or add it to a .htaccess file and change it to look like this if you want to limit your default index file to just index.html:
DirectoryIndex index.html
You can also include more resources and they will be used in the order given, e.g
DirectoryIndex index.html index.php
would display the index.html file first if both index.html and index.php existed.
Don't forget to restart Apache if you made the change to the httpd.conf file.
Look at the mod_dir documentation for more information.
Apache will not trigger HTTP redirections unless you instruct it to do so.
My advice is that you open your favourite text editor and search for the class string in the following locations:
*.conf files inside the Apache installation directory.
.htaccess files inside your HTML directores.
If that fails to find anything, you could also search for header() calls in your *.php code.

Categories