[eluser]TheFuzzy0ne[/eluser]
First of all, I am by no means an expert on this subject, but I have had a fair amount of experience with troubleshooting these kinds of problems on my own server.
As such, some of the information I supply may not be 100% correct, so please do not take what I say as gospel. However, I'm hoping it might give you some more ideas about where to go from here.
[quote author="Dunmail" date="1362849883"]I've a CodeIgniter site up and running on localhost. If I try and access it from another machine on my local network I get a 404 message.[/quote]
I'm assuming you're running XAMPP?
[quote author="Dunmail" date="1362849883"]
My .htaccess file looks like:
Code:
Options +FollowSymLinks
rewriteEngine on
#RewriteBase /myapp-dev/
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L,QSA]
[/quote]
.htaccess files can be a bit of a pain, because servers can interpret things differently.
You shouldn't need to specify the RewriteBase, and if you do, it probably should just be '/', because myapp-dev is set as being the document root in your vhosts file.
Your rewrite rule *might* need to be changed to one of the following:
Code:
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteRule ^(.*)$ index.php?/$1 [L]
I've ditched the QSA, because I've no idea what it does, and I don't have it in my .htaccess file (which works).
[quote author="Dunmail" date="1362849883"]
RewriteCond directive then I get a PATH_INFO warning on the front page of the site referring to
Code:
basename($_SERVER["PATH_INFO"])
This doesn't appear on any other page on the site even though the line of code that it is on is in a footer template that is used on every page. The site does work on localhost without this RewriteCond directive.
[/quote]
That may be because it's not being set correctly when there's no path info being passed to the server. By that, I mean that you're calling index.php with no arguments.
[quote author="Dunmail" date="1362849883"]
If I change httpd-vhosts.conf to
Code:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/Users/dunmail/Sites"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/dunmail/Sites/myapp-dev"
ServerName myapp-dev
<Directory /Users/dunmail/Sites/myapp-dev>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
[/quote]
I'm not actually sure that localhost is a valid server name. I would recommend you make something up, such as myapp.dev and use that. You'll then need to add an entry to the hosts file on both machines, to map it to the correct IP address, then you can use a domain name instead of an IP address. It will also help if you ever decide to run multiple Web sites on that machine.
[quote author="Dunmail" date="1362849883"]
then the home page appears as bare bones html but no links work - they are all of the form: '/contact'. Also the page has no styling as the link to the stylesheet also doesn't work. In this mode I can go directly to the pages by typing the URI in to the address bar.
The addresses don't appear to be rewritten correctly for the remote machine as they are "192.168.1.4/contact" rather than "192.168.1.4/myapp-dev/contact". Modrewrite is enabled on the server as I use it elsewhere in non-codeigniter projects.
[/quote]
I think it's your .htaccess file that's messing this up for you. I think renaming it to something else (so that it doesn't get parsed anymore), will be a good starting point. Then you can fix your XAMPP problem with the .htaccess file out of the equation. Since .htaccess files (in my experience) are kind of volatile, it make sense to continue without it so as to avoid complications.
What OS are you running your server on?
[quote author="Dunmail" date="1362849883"]
I'm missing something obvious here :-(
[/quote]
It's certainly not obvious to me, I can tell you that much.