Getting an error when I visit http://localhost - php

I am trying to access localhost on my xampp via the Chrome browser but I get this error message:
Object not found!
The requested URL was not found on this server. If you entered the
URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
Apache and MySQL are turned on so I don't understand.

You can access "localhost" just fine.
The "404: file not found" error indicates the server can't find the requested file once you've connected to localhost.
ADDENDUM:
Maybe try to create a regular html file called test.html in one of
your vhosts that is not working. Then try to visit that url. That
should give you some clue as to what may be the problem. – Gohn67
This is good advice. Try it. Specifically:
1) Create the following five files:
C:/xampp/htdocs/dummy-host.localhost/test.html
C:/xampp/htdocs/my/test.html
C:/xampp/htdocs/launcher/public_html/test.html
C:/xampp/htdocs/website/httpdocs/test.html
C:/xampp/htdocs/my/test.html
2) Make sure each of these directories exist, and each has a "test.html" with the words "TESTING 1...2...3" in it
3) Try each of these five URLs in your browser:
http://localhost/test.html
http://itutormaths.web/test.html
http://itutormaths.mod/test.html
http://itutormaths.hub/test.html
http://my.itm/test.html
4) Report back the exact error you get from each browser URL

Navigate here:
http://localhost/
If that works, everything is okay.
Paste wordpress to xampp/htdocs, and you should not get any error.

I had a similar issue and this is how I resolved it:
Open the httpd:conf file on the Apache module in XAMPP (click the Congif button)
Scroll through the file - after the first set of comments (#) there is a line of code which says 'Listen 80'. Change this to 81 (or whatever other port you want to use).
Open web browser and explicitly define the port in the web address:
127.0.0.1:81
The may or may work for you; I initially had the issue that Apache wouldn't start at all, which is why I changed the port number (couldn't be bothered to figure out which service was using port 80 - if you want to you can use the command netstats -a or netstats -b in command prompt to figure it out)
Hope this helps

I just encountered this and solve this by creating .htaccess file.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /yourfoldername/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

Related

WordPress gives 500 server error after changing the site url to work with Weglot translation plugin

I am a new WordPress user and recently I added Weglot multilingual support to my website. I wanted to have English as my default URL so I foolishly try to change the site address URL and WordPress address URL at Settings->General to https://example.com/en, which started the problem, I was not able to access WordPress itself.
Then I changed the WordPress address URL and site address URL in the WordPress database wp_options table. Now I am able to access WordPress but my other pages or the URL generated by Weglot to support multilingual stuff like https://example.com/en/servizi/ is not loading and giving the same error as below:
Internal Server Error The server encountered an internal error or
misconfiguration and was unable to complete your request.
Please contact the server administrator at [no address given] to
inform them of the time this error occurred, and the actions you
performed just before this error.
More information about this error may be available in the server error
log.
Additionally, a 500 Internal Server Error error was encountered while
trying to use an ErrorDocument to handle the request.
Apache/2.4.41 Server at example.com Port 443
And when I checked respective pages, it shows below error for wp-asset-clean-up: CSS and javascript manager plugin.
Note: The checked URL returned an error when fetching the assets via
AJAX call. This could be because of a firewall that is blocking the
AJAX call, a redirect loop or an error in the script that is
retrieving the output which could be due to an incompatibility between
the plugin and the WordPress setup you are using.
Here is the response from the call:
Status Code Error: 500 * for more information about client and server
errors, check this link Suggestion: Select “WP Remote Post” as a
method of retrieving the assets from the “Settings” page. If that
doesn’t fix the issue, just use “Manage in Front-end” option which
should always work and submit a ticket about your problem. Output:
Internal Server Error The server encountered an internal error or
misconfiguration and was unable to complete your request.
Please contact the server administrator at [no address given] to
inform them of the time this error occurred, and the actions you
performed just before this error.
More information about this error may be available in the server error
log.
Additionally, a 500 Internal Server Error error was encountered while
trying to use an ErrorDocument to handle the request.
Apache/2.4.41 Server at example.com Port 443
Did you flush your permalinks? Go to Wordpress admin -> Settings -> Permalinks and click save, It should flush your permalinks.
After that check your .htaccess, I had simular issue once and I had to change the .htaccess to work properly.
This seems like a problem from .htaccess...
First check If .htaccess looks like this.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
After that try this solution, this worked for me once when I had that issue.
DirectoryIndex index.php
RewriteEngine on
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php [L]
Then check your apache logs via ssh
sudo tail /var/log/apache2/error.log
Last thing I recommend If you have any cache plugins disable them.
Oh and all the time try to flush your permalinks.
1. Set your WP urls correctly
Firstly, you haven't moved the location of the WP installation, so your Site URL shouldn't change. If you want the WP site to run from /en by default, then you only need to change your Home URL.
WP_SITEURL: https://example.com/
WP_HOME : https://example.com/en/
2. Change all the URLs in the database
WP websites store a lot of full URLs in the database, and changing the site & home URLs doesn't change the URLs in the db entries.
I assume you need to change all your urls to use /en/ for the site to work (that's specific to the plugin so I can only guess based on your question) - if so you need to find all the URLs in the database that use https://example.com/ and replace them with https://example.com/en/.
You could do this manually, but it can be tricky so my suggestion is to use a plugin such as which will find and change all the URLs. The one I use is Better Search Replace but there are others.
Make a backup first! Of course, before you do this make sure you make a backup - once you change the database, you can't just undo those changes!
I'm not familiar this plugin, so I'm not sure if there are plugin-specific changes after that - that's a question for the plugin support as its specific to that plugin and is beyond the scope of how we can help out here. But those steps should get you back up & running again anyway.
TIP - resetting your Home and Site URLs after making a mistake
If you change your Home and Site URLs and can no longer get the site to work, you can override the WP Home and Site address URLs in your wp-config.php file - just add these lines near the top:
define('WP_HOME','https://example.com/');
define('WP_SITEURL','https://example.com/');
Now you can get back into the admin and website, to fix whatever changes you made.

XMAPP - PHP - Error 400

So, this question has probably been answered before but i have changed ports in my conf files which most other posts has not. I'm suspecting this is why it won't work.
So, first i had a problem where skype was using the ports xmapp used, so i changed them to : 8080 and 4433. I also changed server name to : localhost:8080 and www.example.com:4433
When i try to go to localhost:4433 using google chrome i get :
Error 400
"Bad Request!, Your browser (or proxy) sent a request that this server could not understand."
And when i try with just localhost i get a white page.
And when i try t go to phpadmin "localhost/phpmyadmin"
it displays a white page.
Both mySql and Apache servers are running without any errors.
Any idea why and how to fix this problem? I've spent 15 hours now fixing 3 different errors.
actually you have change this port at two places in httpd.conf file,i.e
1) Listen 80
2) ServerName localhost:80
at the above places the port value should be 4433, as per your changes
Old question, but I had this error start suddenly to my XAMPP instance on WIndows 7.
It started when I was doing a cleanup and removed a folder that was referenced as a redirect in the .htaccess file.
e.g.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>
If the folder public is removed/renamed, this error will start to occur, even with the simplest of PHP or HTML files being requested.
I fixed by removing the .htaccess - when I need it again I'll add it back in with the right paths.

.htaccess URL Rewrite Error - The requested URL was not found on this server

I have a very simple rewrite rule. My entire .htaccess file is as follows:
RewriteEngine On
RewriteRule ^login/([a-zA-Z0-9-/]+)$ company-page.php?company_url=$1
RewriteRule ^login/([a-zA-Z0-9-/]+)/$ company-page.php?company_url=$1
This is perfectly run on locally Wamp server but not working on online server. It display following error.!
The requested URL /EZsample/login/mereco-technologies/ was not found on this server.
Can anyone help me!
if you are using a VPS please use this article,
1.Make sure u have enabled Mod_Rewrite ?
2.Made the changes in the virtual host configurations
https://www.digitalocean.com/community/tutorials/how-to-set-up-mod_rewrite
This line of code helped me solve a very similar issue:
Options -MultiViews

500 Internal Server Error with Wamp server

I've created a web service using php, slim and mysql but when I try to access the urls it gives me "The server encountered an internal error or misconfiguration and was unable to complete your request."
When I check the log it gives me :
C:/wamp/www/task_manager/.htaccess: Invalid command '.htaccess', perhaps misspelled or defined by a module not included in the server configuration
I checked few things online and I can ensure you that rewrite_module is installed and activated (not commented in the http.config
does anyone know how to fix that?
I ll attach the content of my .htaccess
.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L]
Remove the line .htaccess from your .htaccess file.
if you install new wamp on your system,
and you are using htaccess in your project to rewrite some urls first you need:
Click on wamp icon and Go to "Apache" Then Click on "Apache Modules"
and make sure your RE WRITE extension should be checked.

File not found with .htaccess file on Apache server

I have this .htaccess on my Windows dev machine and everything works fine
RewriteEngine On
RewriteRule ^(.+[^/])/$ http://%{HTTP_HOST}/webserv/$1 [R=301,L]
RewriteRule ^login/([0-9]+)/([0-9]+)$ login.php?par1=$1&par2=$2 [L,NC,QSA]
When I upload it on my Centos server I get the error
404 The requested URL path_to_script/login.php was not found on this server.
I cannot understand why this is. The file is definitely there and I gave permissions 777.
I have checked if the .htaccess is actually used by adding rubbish in it and getting an internal error (500) which means that it is working.
Also when I use .htaccess to make restrictions on IPs that have access to the directory it works. mod_rewrite is loaded as shown in the phpinfo() I have tried.
I am at a loss here.
EDIT
I noticed that it tries to search in the base_path appending it to the root path e.g.
/path_to_script/path_to_script/login.php
And that is why it fails. How do I solve this?
I finally solved it but in a way that I am not sure I like. At least it works. If someone has a better solution I would be glad to see it.
RewriteRule ^login/([0-9]+)/([0-9]+)$ http://host/webserv/login.php?par1=$1&par2=$2
The reason I don't like this solution is because I does not give a pretty url. It just redirects.
I still do not understand why I get the root directory appended to the request if I instead write:
RewriteRule ^login/([0-9]+)/([0-9]+)$ login.php?par1=$1&par2=$2

Categories