localhost domain does not resolve properly on CodeIgniter and Wordpress - html

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.

I fixed the CodeIgniter issue by going to the config.php file and setting:
$config['base_url'] = '';
The Wordpress fix is temporary, until I can set up my DNS server to serve local hostnames. I put the Wordpress Home and Site URLs to the local IP address. This works for the moment, but if I switch networks, it will break again.

Related

Can not display drupal console and phpmyadmin on local host at same time

I am absolute beginner on Drupal, and nearly that on setting up localhost on my Mac along with MySql. My problem is I can't display Drupal and run phpmyadmin on separate tabs in my browser at the same time. I found that changing the 'AllowOverride' parm in my http.conf file will allow one or the other to work, but not both at the same time.
So in etc/apache2/httpd.conf <Directory "/Library/WebServer/Documents"> section:
If use 'AllowOverride None'
Can get to http://localhost/phpmyadmin/index.php
Cannot get to http://localhost/user/login (get 'The requested URL /user/login was not found on this server')
If use 'AllowOverride All'
Can not get to http://localhost/phpmyadmin/index.php (get 'You don't have permission to access /phpmyadmin/ on this server.')
Can get to http://localhost/user/login
Any ideas?
AllowOverride should be set to "All" since that way you are allowing .htaccess file to work properly (i.e. do redirections and make pretty urls work).
If phpMyAdmin is not working with that setup that means that Drupal's .htaccess rules are catching your requests to phpMyAdmin. That probably means that you installed Drupal directly inside web root and phpMyAdmin inside it's one directory (as a sub-site of Drupal). So even you are calling phpMyAdmin Drupal jumps in and takes control of that request.
One solution would be to install Drupal inside it's own directory, so you could access your project as i.e.
http://localhost/drupal
That way Drupal's .htaccess file will be inside drupal dir and not in web root dir.
Other solution would be to create virtual hosts, so depending on used domain web server would know which site to display (to serve request from which directory).

Why do I get a 500 internal server error when trying to access an html file in public_html using cPanel/godaddy?

I have a godaddy website hosted through cPanel, but the html file, named test.html, will not appear when searching "website_name"/test.html. This is the contents of the file:
<!DOCTYPE html><head></head><body>TEST</body></html>
There is no .htaccess, although permissions are set to 644. The server displays the 500 error regardless of whether a valid address was entered. Additionally, the DNS domain and the actual ip address show different things: The DNS shows an index page I can't find in my public_html, whereas the ip shows the godaddy "Future home of something quite cool." message.
Background: I inherited this project as part of a new job. I can set up an apache server with php and mySQL support (in fact I went from using an xampp install to just running everything from command line for practice), but my employer has two godaddy domains: one made using a website building, and one using cPanel for which I am to write my own HTML, CSS, php, js, etc. I have searched extensively across godaddy, google and stack exchange, and have found nothing so far that has worked. The cPanel File Manager has a couple files in it, but nothing will open as a url (I can edit the files though). I checked the godaddy documentation and follow the tutorials and nothing has helped. Any help is appreciated. As an aside, I’m wondering if it would just be easier to completely restart the whole process? The html/css/php files are kind of a hodgepodge and would require rewrites anyway, and bootstrap is used as a source file in every one but never actually implemented. The environment is very relaxed so long as I’m working on something productive.

I cannot load my website. Instead I get the wordpress installation process page

I hosted a wordpress website then I decided to change it and use spip instead. Now when I try to load the website on my laptop I get the wordpress installation process.
It seems to work fine when I load the website on my phone.
Did you import your Database ? or did you change / delete your database ?
if you change host or website you need to upload old Database and do db-replace of urls

How to use Wordpress with localhost and a preexisting database on another server

I've been working on a Wordpress website on my web hosting server. But I wanted to start doing the Wordpress changes locally, while still using the database with all the posts and stuff that's already on the server.
I installed Wordpress on my computer, and had it connect successfully to that database, but going to localhost/website/wp-admin would redirect me to www.site.com/website/wp-admin, and then proceed to do everything on the server again, which I didn't want, and localhost/website would just appear blank.
I tried having Wordpress use a new test_database on the server, and it was happy with that. Wordpress started to run locally, localhost/website wasn't black, while using a database on the server. Even when I wiped out my local Wordpress and reinstalled it connecting to test_database, all the posts remained intact, and Wordpress was still running locally.
How come I was unable to get Wordpress running locally when I tried to connect to the first database?
You're trying to use the same WordPress database instance on two different URLs. You Can't Do That™. Someplace in the options table is the database's URL. It's used to construct many links in WordPress. That's why you're jumping back to the production server.
You can use a plugin like Duplicator to make a copy of your production web site to use as a staging server, or vice versa.

Hosting web app on xampp

*I hav made a small demo web app(using html5, and jquery mobile)
*I have installed and set up Xampp
*set passwords for local server
* I am confused as in what to do next, where do i store my .html files and other resources
*I need to test my app on a network
*I want to set up a database using xampp ,(i have no idea how to)
*edit: since its a mobile web app, i want to test it from my mobile, is it possible by hosting it on my pc ? If yes, then how?
If you have the apache server running on xampp, you have to put the files in the /htdocs map. This is usually located in something like C:/xampp/htdocs. Then you go to your localhost in your browsers, so localhost and then /example.html.
This would be for example localhost/example.html, this would redirect to the example.html file in the htdocs folder.
Then if you want to set up an mySQL database you should take a look around at localhost/phpmyadmin