Unexpected Rewrite - php

On localhost, in one of my folders, files are accessible like http://localhost/folder/map instead of http://localhost/folder/map.php. It's probably because of something wrong with Apache's configuration but I'm stuck here and nothing comes to my mind.

If you have a file called index.php or index.html in your http://localhost/folder/map folder, Apache will run that file when you just enter the directory name as a browser url.
This is what makes http://localhost run a page rather than just showing you a directory listing, or show a blank page.
This is probably the reason that you see a valid page when just keying in the http://localhost/folder/map url.

Related

My localhost doesn't see my html and php files from www on Windows 10 (wamp)

So when I try to access http://localhost from Chrome it directs me to WAMPSERVER Homepage and it doesn't show me the html or php files that I have in the www folder. What should I do?
If you want to access anything except ixdex.html or index.php, you will need to
provide the absolute path in the url like
http://localhost/your_folder/page.php Or based on url_patterns defined in rewriter config.
If you don't specify the page file name then the file with the name index.html is displayed, which is happening right now.

Change Website from Plain HTML to Wordpress

I have a static html website that I need to convert to Wordpress. I was able to successfully load wordpress on my hosting and configured a theme. However, the front end still displays the original html page. I need the whole website to be converted to wordpress, but I can't figure out where to add the htaccess and index.php files as I read from a blog. Someone help out.
Thanks
Sam
1) you're kind of asking for the whole of how the internet operates. I'm not saying that to be confrontational, just know that you'll likely be downvoted for such an impossible question.
2) more to the point, your server is looking for a directory index. In general, most servers look for index.html, index.htm, index.php, and then others, but in that order. If it encounters index.html in your directory then it stops and says that is the file to load.
3) you can get around this by changing the name of your file.
"index.html" -> "index_OLD.html" (or any name not index.html)
4) you can also change the way your server processes the index order using the DirectoryIndex directive in your HTAccess file. Ask your hosting provider about how to do this and if it's supported (although, I don't recommend you do this, it's just an available option).
5) your wordpress install should be in the root directory. That is to say, your .htaccess and index.php files should live in the same directory that your current index.html file lives in. Once the html file has a different name, the server will locate the php file and use it to server up as the directory index.
6) good luck friend!

WAMP: Index.php executes/runs immediately when selecting the directory it is in

I had a little, slightly annoying problem that was an easy fix but I didn't understand why it took place.
I have a several folders in ../wamp/www/- and in one of them I had a file, that I had created, named index.php. When I clicked on the other directories I could browse through the normal list where I saw all the files, but when I opened the folder where the file Index.php was it executed immediately and I never saw what was in the folder. Instead I had to manually change the url to open other files in that directory.
I deleted index.php and half expected it to run some other .php-file in that directory, but didn't.
I'm aware of that there is a index.php-file in the www-directory (the comments in French though), which clearly is part of the WAMP system I downloaded, but having seen tutorials where people use index.php I'd have expected someone to mention this potential problem.
This is not a problem!
This is how web servers work.
To be specific there is a setting in the Apache config that tells Apache the names of files that it should run Automatically if no actual file is specified in the URL
Specifically this line in httpd.conf
DirectoryIndex index.php index.php3 index.html index.htm
It is normal that a web server will run any of these files if it sees them when only the directory is specified on a URL.
And before you consider changing it, dont. Almost everything you will come accross EXPECTS this to be the case.

Xampp files not showing up

I'm using Xampp no problem. I normally type localhost/assignment2 and the list of php pages I created come up but I just created an index.php page and now when I type localhost/assignment2 the index page is showing instead of my list a programs I made.
Is there a way I can rectify this or do I need to do something specific to it.
You server will always search for index.php, index.html and index.htm in your folder and show it if it exists. If none of these files exists the server shows a list of all files or an error, depending on your configuration.
This is happening because there is conflict between the name of xamp's index.php and the index.php that you have created.The same problem will arise if you create home.php. By default xamp gives preference to the index.php file and instead of showing the index of files it ends up displaying index.php. So the solution is to change your index.php filename to index1.php .

Wamp Server showing blank page for nested directory

This link
http://localhost/
works fine.
This link doesn't work
http://localhost/shlingy/
directory location
C:\wamp\www\shlingy\index.html
Does anybody know why this link does not work?
Check whether there is a .htaccess file in www or www/shlingy directory or not. If there is, rename or remove it. Probably a rewrite rule in that file is causing the problem.
Also, make a index.html file in the www/shlingy directory which will be displayed when you access the shlingy.
It was a mistake on my end that i call a constructor of PHP file at the start page but that file contain an error. Its annoying that server just show blank page instead of error Massagining

Categories