JamesB Posted November 24, 2014 Share Posted November 24, 2014 (edited) This works on my web server but not on my friend's web server. There are 3 websites like so: 1. http://www.ukscifi.net/ - Some old CMS. 2. http://www.ukscifi.net/uks2/ - CodeIgniter framework. 3. http://www.ukscifi.net/uks2/forum/ - SMF forum. The problem is with the 2nd one. When I go to a controller called "welcome", I get a 404. This is the URL I go to: http://www.ukscifi.net/uks2/welcome But on my local server I luckily don't get a 404. Any ideas what could be causing this to not work? Edit: The .htaccess file in /uks2/ folder is: RewriteEngine onRewriteCond $1 !^(index.php|public|robots.txt)RewriteRule ^(.*)$ /uks2/index.php/$1 [L] Edited November 25, 2014 by JamesB Link to comment Share on other sites More sharing options...
justsomeguy Posted November 25, 2014 Share Posted November 25, 2014 Are you both running the same server software? Can you verify that it is redirecting to index.php? You could have that code write to a log file, for example. Link to comment Share on other sites More sharing options...
JamesB Posted November 25, 2014 Author Share Posted November 25, 2014 I am running Apache/2.2.17 (Win32) PHP/5.3.5 My friend is running Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.5 I added this code to top of index.php in /uks2/ folder: echo 'test1';exit; And when going to this URL http://www.ukscifi.net/uks2/welcome I still get the 404. The 404 I see isn't the CodeIgniter controller-not-found page either, it seems to be an Apache not found page. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 25, 2014 Share Posted November 25, 2014 It's not going to show an echo statement if it shows the server 404 page, but writing to a log file will always work. That's why I suggested it. Otherwise, I would start with Apache's own log files to try and figure out what's going on. There is both an access log and an error log that you can check. Link to comment Share on other sites More sharing options...
JamesB Posted November 25, 2014 Author Share Posted November 25, 2014 (edited) When I visit the URL, there is nothing in error.log, but this is in access.log: <my ip here> - - [25/Nov/2014:20:12:51 +0000] "GET /uks2/welcome HTTP/1.1" 404 506 "-" "Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.17" Regarding the logging, would this be done in the htaccess file? Edited November 25, 2014 by JamesB Link to comment Share on other sites More sharing options...
justsomeguy Posted November 25, 2014 Share Posted November 25, 2014 No, I'm talking about having PHP write something to a file so that you can tell that the PHP file was executed regardless of what shows up in the browser.After the 404 in that entry is 506. A 506 code would imply that the redirects are going to a page that is being redirected, or that index.php is set to redirect to index.php. The server sees that and stops the loop and just says 404. I'm not sure if that 506 refers to the HTTP response code, but if so then that's what it means. Link to comment Share on other sites More sharing options...
JamesB Posted November 25, 2014 Author Share Posted November 25, 2014 Ok I added a logging line: file_put_contents('blah.txt', 'test1'); This file does not get created when I visit the URL, http://www.ukscifi.net/uks2/welcome But the file does of course get created when I visit this URL: http://www.ukscifi.net/uks2/ I think the second number is the response size according to http://stackoverflow.com/questions/9234699/understanding-apache-access-log. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 25, 2014 Share Posted November 25, 2014 That seems right.Maybe Apache isn't using htaccess at all.https://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles Link to comment Share on other sites More sharing options...
JamesB Posted November 26, 2014 Author Share Posted November 26, 2014 I've followed the instructions on that website, still no luck.Still getting the Apache 404. default.conf and ukscifi.conf in /etc/apache2/ now look like this: <VirtualHost *:80>ServerName events.ukscifi.netServerAdmin keithvc1972@ukscifi.netDocumentRoot /Webroot/www/#LogLevel info ssl:warnErrorLog ${APACHE_LOG_DIR}/error.logCustomLog ${APACHE_LOG_DIR}/access.log combined#Include conf-available/serve-cgi-bin.conf</VirtualHost><Directory /var/www/>Options Indexes FollowSymLinks MultiViewsAllowOverride AllOrder allow,denyallow from all</Directory># vim: syntax=apache ts=4 sw=4 sts=4 sr noet I made sure to reload Apache too. Link to comment Share on other sites More sharing options...
JamesB Posted November 26, 2014 Author Share Posted November 26, 2014 However when I change the htaccess file in the /uks2/ folder to this: RewriteEngine onRewriteRule ^(.*)$ /uks2/public/css/core.css [L] I don't see the css file when visiting http://www.ukscifi.net/uks2/, I actually still see my CodeIgniter project's default page. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 26, 2014 Share Posted November 26, 2014 Put some syntax errors in the .htaccess file and check if Apache returns a 500. Link to comment Share on other sites More sharing options...
JamesB Posted November 26, 2014 Author Share Posted November 26, 2014 Ok I have put this in the htaccess file: 0943IM,E54341.e4htdrs8gh76ti6/$%Y&I85&^86%^34%4353w5345r23RewriteEngine onRewriteRule ^(.*)$ /uks2/public/css/core.css [L] And when I visit http://www.ukscifi.net/uks2/ the page still works and gives me a 200, no 500 anywhere. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 26, 2014 Share Posted November 26, 2014 It sounds like it's still not using the htaccess file. Link to comment Share on other sites More sharing options...
JamesB Posted November 27, 2014 Author Share Posted November 27, 2014 Got it working! There were 4 .conf files in /etc/apache2/sites-available/ I tried editing default.conf and ukscifi.conf but in fact I needed to edit 000-default.conf. Thanks a lot, learned quite a bit on this. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now