0

I am having a strange issue with Apache, Wordpress, and CodeIgniter. I have a laptop which I use for web dev, and it works fine. However, when I tried to access the sites hosted on the laptop's Apache installation through its IP address, the CSS would not load. When I examined the page source, it listed the path of the CSS file as http://localhost/css/site.css, even though I was accessing the page remotely.

I am running Wordpress and CodeIgniter on the same server, in different subdirectories. On the CodeIgniter header templates, I use <?php echo base_url('/css/style.css');?> to access the style, and on Wordpress <?php bloginfo('stylesheet_url'); ?>. Furthermore, when trying to access the admin panel on Wordpress, I am redirected from http://10.0.0.1/wordpress/wp-admin to http://localhost/wordpress/wp-admin, which breaks the admin panel too.

Strangely, this issue does not appear on the pure HTML sites, where I use a relative path for the CSS.

I suspect the problem lies with the WP and CodeIgniter config files, which have the domain of the sites listed as localhost. Another source of the problem could be the Apache config, but I have no idea where to start looking for it.

4

1 に答える 1

0

config.phpファイルに移動して設定することで、CodeIgniterの問題を修正しました。

$config['base_url'] = '';

Wordpress の修正は、ローカル ホスト名を提供するように DNS サーバーをセットアップできるようになるまでの一時的なものです。Wordpress のホームとサイトの URL をローカル IP アドレスに設定しました。これは今のところ機能しますが、ネットワークを切り替えると、再び壊れます。

于 2013-07-20T03:30:55.023 に答える