0

I'm working on a local MAMP website. I use a micro MVC framework to use friendly urls so I don't need to call index.php (which is inside of public_html directory) in the urls.

To achieve that, I have the following htaccess:

RewriteEngine on
RewriteCond %{REQUEST_URI} !public_html/
RewriteRule (.*) /public_html/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]

Then I have the following line in /etc/hosts

127.0.0.1   mywebsite

Also, I have the following in httpd.conf

<VirtualHost *>
  DocumentRoot "/Applications/MAMP/htdocs/mywebsite"
  ServerName mywebsite
</VirtualHost>

So if I simply call http://mywebsite from the browser, the whole thing works smoothly.

So what's the problem?

The problem appears if I try to reach the same page from another machine in my LAN.

So if I write http://192.168.1.15/mywebsite the answer is:

Not Found

The requested URL /public_html/ was not found on this server.

I get the same message if I call http://localhost/mywebsite from my own machine.

I have the feeling that is something related to .htaccess, but I've been trying a lot of different ideas I've found in the web, and nothing works.

I'd like to fix this, because I need other people to check the website from their machines.

If you have any clue please help. Thanks a lot.

Edit: I can't solve this, so as a temporary fix I've created a free account at AppFog for my team to be able to access the page until we go to production. After all these years, I thought that computing would be easier... it's getting harder, actually. The htaccess file is a huge mistery to me! Thanks anyway :)

Jorge
  • 259
  • 1
  • 7
  • 15

2 Answers2

1

By the way... as I told you, I've found a way to fix the problem. The funny thing is I have to use a different .htaccess file. I thought you could be interested, provided that it seems you like computing stuff :)

This is the .htaccess that works in my LAN debian server:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/(www/.*)$
RewriteRule ^(.*)$ index.php [QSA,L]

As you can see, it's different from the one I showed you at my first post. My conclusion? Well, even when I always try to keep things simple, life shows me one and another time that everything can be more complicated. Look at the .htaccess file. It's so funny... I've learnt to work with it by using different combinations of code.

Isn't it crazy? Yes it is. Please let's do understandable software. Thank you!

Jorge
  • 259
  • 1
  • 7
  • 15
0

Ok, I've been trying a lot of different things and all of them fail. The only solution I've found is to install the web site in a separated LAN debian server. Everything works ok in that way, but it's not possible to make it work from my machine with MAMP.

Why not? Well, I don't know. After a lot of years in computing, I've learnt to say "I don“t know", you know what I mean.

I've been working for a few days with an AppFog account for free but, you know, that thing cannot work when you put a database and the whole thing there. Obvious.

So at the end the only solution I've found has been to put everything at that local LAN debian server.

Thank you anyway :)

Jorge
  • 259
  • 1
  • 7
  • 15