Webiste url are not routing without index.php - 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.

Related

How to set up PHP script to receive requests to non-existent directories in a directory?

Say, if I have a dir directory in a root directory on the server with index.php file in it, can I set up that index.php to be called for any of the following links:
https://example.com/dir/
https://example.com/dir/something
https://example.com/dir/something_else
Sorry, I'm not sure how to call this, but basically so that the last segment of the URL was passed into index.php script that is in the example.com/dir/.
PS. My website is hosted on a shared web hosting platform.
Instead of having an index.php in every folder, you can leverage FallbackResource by creating an .htaccess file and putting in the following:
FallbackResource /index.php
Then, you can parse $_SERVER['REQUEST_URI'], and do whatever you want with it.

Apache directory issue which redirects request to index.php

I have a joomla website.
In my public_html where Joomla is installed, I have a directory named "logs-list".
When I go to the address http://example.com/logs-list/file.txt, I expect the file to be shown, but instead APACHE redirects to index.php, it assumes as if this is a request for Joomla. This has confused me. What should I do?
UPDATE
how I can tell in .htaccess to stick to the physical directory for a certain URL?

Bring local site to live site url not working

I have developed a site using drupal 7. I have moved my site from local server to live server.
But the live Url not opening my sites index page. For example, my web site address is http://test.com. But if i change the URL like http://test.com/2index.php it works well. Somebody help me please
File name should be index.php not 2index.php.
I agree the that file name should be index.php, however if there is some reason why the name must be 2index.php and you want it to serve as an index, you need to modify your apache config file to include "2index.php" as one the options for the "DirectoryIndex". The config line may look like this:
DirectoryIndex index.php index.phtml index.html index.htm 2index.php

Website - Not Showing Index

Ok, I am very new to web development, so excuse that. I set up my webserver using a Linode Stackscript (LAMP). However, my webpage doesn't display my actual index.php file, instead, it displays http://www.imgbomb.com/i/?lBqKe. Why is this? My index.php is inside my www. When I type /index.php after the url, I get a the page you are looking for is not found.
You should add DirectoryIndex index.php to your .htaccess file or webserver configuration file.

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.

Categories