Xampp - Перенаправьте внешний URL к localhost

Сначала я проверю файлы с помощью leftFile.exists() и rightFile.exists(). Я думаю, проблема в том, что у вас нет этих файлов на вашем пути.

7
задан Tom 8 April 2009 в 09:48
поделиться

3 ответа

Мне приходят на ум два решения:

  1. Использовать относительные URL (предпочтительнее)
  2. Добавить свой внешний URL в Ваш файл hosts, который можно найти в

    C: \ WINDOWS \ system32 \ drivers \ etc \ hosts (Windows)

    или

    / etc / hosts (Linux)

    Просто добавьте эту строку:

    www.mysite.com localhost

    Может быть, вам придется использовать ip своих серверов вместо mysite.com, я не уверен прямо сейчас

7
ответ дан 6 December 2019 в 14:09
поделиться

Yes : dont use hardcoded links !

Seriously, I'm not sure if I understood correctly. If you are talking of URLs in your pages pointing to other pages on the same site, you should use links of the form "/example/view.php" instead of "http://www.mysite.com/example/view.php". That way, you will always point to the same site.

If those links go to external sites, but you need to redirect them locally for testing (I cant see why this would be the case, but you never know ...) then you could use a varable in a config file. The you would just need to change this variable at one place ...

2
ответ дан 6 December 2019 в 14:09
поделиться

Я только что наткнулся на это.

Используйте эту строку в хостах:

127.0.0.1 www.yoururl.com

5
ответ дан 6 December 2019 в 14:09
поделиться
Другие вопросы по тегам:

Похожие вопросы: