php web application and strange 404 error (something wrong with Apache ?) - php

I have downloaded a php web application from the web (OntoWiki).
After the installation I've tried it and it works fine on my Ubuntu 10.10, but when I try to install it on CentOS Linux, the only page that works is the home page (index.php).
If i try to change the page, the browser sends me a 404 error page (page not found).
Instead if i try to change the URL with the "index.php" as prefix it works fine.
Example:
localhost/app/index.php/directory -> works
localhost/app/directory -> doesn't work (404 error)
Why does this happen? On the PC where the program works i have the URL like: host/application but everything works fine.
Is there an Apache Configuration problem?
Thanks in advance

Check you have mod_rewrite enabled on your CentOS server.

Active the Apache rewrite module:
a2enmod rewrite
Restart Apache.

In an application like OntoWiki, all requests are directed through index.php. An .htaccess file accompanies the project including RewriteRule's to map a path like /directory to /index.php/directory.
Apache's mod_rewrite module must be installed and enabled for the host in order for the RewriteRules to be applied. It sounds like you have it disabled on your CentOS box and enabled locally.

Related

Htaccess giving 404 error on Aws Linux 2 AMI

I have set up an elastic beanstalk and deployed my application to it, the application has a .htaccess file in it. .htaccess works perfectly on my localhost but when checking it on the live server it gives back a 404 error.
For Example
I have a login file named login_1.php, on my .htaccess I've set the file to be called login.
When clicking the login link on my localhost it sends me to the login_1.php file with the URL name of login, but when clicking on the login link on the live server it takes me to a 404 error.
I've followed all instructions on the internet regarding this issue but nothing seems to solve the problem. I've changed AllowOverride None to AllowOverride All on my httpd.conf file. I do not have apache on my ec2 Linux 2 AMI instance so I can't restart apache.
Any help would be much appreciated to fix this.
Thanks,
Arnav
Figured out the answer, went into my elastic beanstalk application and changed the application type to APACHE instead of NGINX. This start httpd sever and allowed me to activate the .htaccess file in my application.

"Not Found" error for all other routes except for / using laravel 5.1 on a EC2 instance AWS

Trying to set up a laravel 5.1 project on EC2 (aws). I've so far installed a LAMP stack (php 5.6) and composer. It all seems to be working fine. Was even able to run migrations for the laravel app, But whenever I try to go to any route except '/' I get a
Not Found
The requested URL /public/pricing was not found on this server.
Apache/2.4.7 (Ubuntu) Server at compute.amazonaws.com Port 80
error.
Not sure whats going on. It works perfectly fine on my localhost using mamp.
Three things to consider;
1) you should set the document root to public not the Laravel directory. In simpler words, users should be be able to access the Laravel directory.
2) check out your Apache find files or .htaccess to allow for override
AllowOverride All
3) Make sure mode_rewrite is enabled
sudo a2enmod rewrite
So it sounds/looks like you are missing the htaccess file:
http://laravel.com/docs/5.1#configuration
If you navigate to /public/index.php?pricing, the webpage will most likely show up even now.
You will need to configure the .htaccess file to pass requests to index.php to handle the routing.
I enabled mod rewrite
Set up htaccess
AllowOverride All
It didn't change anything. I then killed the connection to the server and rebooted and everything was working. Not exactly sure why this worked but fortunately it did.

Silverstripe not working on Plesk Server

I am trying to create a new domain which runs on SilverStripe 3.0. I am unable to figure out the issue. If I upload a custom php page then it runs fine, but my website is not working. It shows blank page but shows the favico.
If I try to open up www.mydomain.com/admin/, I get the error
Page Not Found
The requested URL /admin/pages was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
This is not a Silverstripe error page. Here is my php info Info
Please let me know if I am missing something or there is any way to figure out the issue.
Try www.yourdomain.com/index.php/admin
If that works then it is because your rewrites are not working. This can be because .htaccess isn't configured properly, or because .htaccess is not used at all (in which case you need to edit your server config).
Last I used Plesk it always used apache. If that is different now and you're using nginx as more than a forward proxy, then you will need to set up the redirects for your site manually.
It does sound like your .htaccess is not being respected. Does Plesk allow overrides for .htaccess in the local directory?
At an apache level we would have something like this stanza to ensure the the .htaccess of the project was respected;
AllowOverride All
If your .htaccess is being processed, make sure that your host has mod_rewrite enabled as that is required to access to pretty URLS.

Wordpress - Only Serving Physical Files After Server Switch

I am helping someone move their WordPress site from a (truly) wretched Dotster shared plan to a VPS.
Everything is transferred and working, except Apache is only serving physical files like index.php and wp-admin/, etc... Other directories on the site will return a 404 error.
I am guessing this has to do with Apache ModRewrite, but I am truly unsure at this point.
Halp!
It looks really like a problem with rewriting.
Make sure you copied your .htaccess files
Make sure Apache mod_rewrite is enabled (for example by running a2enmod rewrite under debian)
Make sure overrided by .htaccess are enabled (AllowOverride All directive in Apache Configuration)
Overrides will make Apache look in .htaccess files. See http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride
Hope it helps!

Codeigniter on IIS web.config issue

I am installing a site made in PHP/CodeIgniter 2 on a hosting server which unfortunately has IIS running, which I have no experience in.
Nothing is working except the homepage, all other pages are returning 404 errors.
Adding index.php to the url returns 500 - Internal server error (I have the index page config set to '' in the config.php file)
I tried also creating a web.config file thinking the issue might be from the redirects, but adding a web.config file stops even the homepage from working, even if the web.config file added is completely empty.
Help really appreciated.
Check if the hosting server has Re-write module installed in it, that could be your problem.
Make sure you had installed URL Rewrite -
http://www.iis.net/downloads/microsoft/url-rewrite
After you had installed the module you should able to see this icon (URL Rewrite) in your IIS Management.

Categories