Codeigniter on IIS web.config issue - php

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.

Related

Wordpress Permalink change won't work

I want to update my permalink structure to postfix from the "plain" type, but every time I try--I get a 404 on every page I try to visit, except for the front page. I've reset my .htaccess, deleted it and recreated it, disabled all plugins, and then tried redoing the .htaccess with the plugins still disabled--but no luck.
I do think this was caused by the "Team" plugin by pickplugins...but still no luck when deleting that and redoing the above.
Any ideas?
Thanks!
Make sure server enable Apache Mode Rewrite properly. This happen all apache servers doesn't install Mode Rewrite.
I would begin by testing whether or not the htaccess file you are editing is being used by the Apache server. To test this, break it intentionally (writing invalid lines of codes can achieve this). Then see if you get the 500 Internal Server Error on your page. If you get that error, then that means your htaccess file is in fact being used by the server.
if the htaccess is working then find out if mod_rewrite is working on your server.

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.

CodeIgniter routing - 404 error after moving to new server

At the moment I am trying to move a website to a new web server. The site uses CodeIgniter and on the old server, every route worked. On the new server none of them are working, even though I copied the entire website from the old server. This means there are no differences in .htaccess files, since the two servers contain the exact same website. Not even the default routes are working, just the home page (index.php). I included the code in .htaccess to remove 'index.php' from routed URLs, but that also does not work.
If I try to visit '1.1.1.1/~user/employees' it will give me a 404 error, which means that the CodeIgniter route is not working. The controller file is located at /application/controllers/employees.php, so I am not sure what causes the problem.
I am aware of the similar posts on the site here, but none of them could solve my problem. Configuration of the config/config.php is (partly) as follows:
$config['base_url'] = '1.1.1.1/~user';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
I have tried to change the base_url, but it still does not work if it's empty. Changing uri_protocol to REQUEST_URI or PATH_INFO also does not work. Also, if I try 1.1.1.1/~user/index.php/employees (so put 'index.php/' in between) I still cannot reach the page. I checked some Apache settings as well, AllowOverride is set to ALL and the mod_rewrite module is installed and enabled. Is there perhaps something else concerning differences in both server's configurations that I could have missed?
EDIT:
I think I am a bit closer to finding out what the problem is. It is either something with Apache or .htaccess (but I already tried many things) or it has to do with the fact that the server URL is 1.1.1.1/~user rather than 2.2.2.2 as it was on the old server. Maybe I should change the baseurl or location of my .htaccess? This looks similar to my problem, but moving the .htaccess did not fix the problem: Url routing errors in php in codeigniter. I might try re-installing Apache.
I think that you firstly should find out what happened.
All requests to CI go through index.php, so you just echo something and exit in index.php file at the first line.
If the page display what you echoed that means there is something wrong in CI, otherwise that's not because of CI. And you can focus on what cause the problem.
Sorry about my English.

Sub-pages always open domain root

I'm having a strange problem with a new PHP page I´m writing. Everything seems to be loading/redirected to the domain root page.
domain.com loads fine
domain.com/page or domain.com/page/index.php always loads "domain.com" while retaining the /page/index.php in the browser URL.
Even domain.com/some_random_text loads "domain.com"
I suspected the .htaccess file, but there is none to be found. There are no redirects in the PHP code.
If I remove the domain.com/index.php file I get an Internal Server Error when opening domain.com/page/index.php
This domain did have Wordpress installed, but I did uninstall that via cPanel.
First thing to notice is that the .htaccess file can be anywhere in the path that is handled by Apache. So check everywhere. This kind of redirect could be made only like that.
This can only be done by Apache, so you might also like to check the apache config if you are running on a virtual machine or dedicated server.
Also, not that it might have been a wildcard redirect, added by the cPanel, so check those settings. Though I think those actually just modify the root .htaccess file.
Based on the data you provided I cannot say more, but I don't think this is a common issue.

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

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.

Categories