Multiple Subdomains on Xampp - wordpress

I want to start developing a site locally and later port it to the web. As I'm planning to run a Wordpress Network using Subdomains, I would need to set-up a Xampp installation that would allow me to run a subdomain install.
No idea how to do this and haven't found much info on the web either. Can someone point me in the right direction? I've seen people managing to change the URL as well. I can't seem to get past http://localhost.

You need two things first of all, and nothing related to wordpress.
Let´s supose you will use a local url like "your_test_domain.local", so:
#1 Add virtual servers on your xampp httpd-vhosts.conf (xampp\apache\conf\extra\httpd-vhosts.conf).
For example:
<VirtualHost *>
DocumentRoot "C:\xampp\htdocs\your_site_folder"
ServerName your_test_domain.local
ServerAlias your_test_domain.local
<Directory "C:\xampp\htdocs\your_site_folder">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
That means, if you surf to "your_site_folder.local" you will see what´s on the "your_site_folder" folder inside xampp htdocs folder. Right?
#2 and also, you need to edit the hosts file on windows (guess you are using win), that´s on: Windows\System32\drivers\etc\, and add this line:
127.0.0.1 your_test_domain.local
Start apache to take this effect. Same thing for subdomains, you only need to create another virtualhost and another host redirection but for "sub_domain.your_test_domain.local"
So, once you got those things, you also will need some plugin to install on wordpress. I use the Domain Mapping Plugin, that will do the rest, but, that´s another story. Start there and you will learn the rest.
Hope that helps.

Try this link
http://www.howtoforge.com/forums/showthread.php?t=23
also watch out for xampp's root index.php file as it has a redirect in it...

Related

What do i have to do to create a local domain for my wordpress instance in xampp within accessing it for any device (exsiting wordpress project)

I have an existing project in wordpress combined with a database on MySQL and ive actually started this project with the newest version of wordpress (wordpress.org) and xampp
At the beginning i was working with the default Settings of xampp like:
- localhost domain only local available (Apache)
After the first steps of coding on wordpress i just asked myself if i could change my 'localhost' domain to something like 'www.example.com' and access this domain for my home network even via wifi to easily show up my work changes on any device at home
ive been searching for a way to create a local network domain
-> This step worked
Actually i could type in the domain ive already changed and then i was able to get my web project on wordpress
Virtual Hosts Configuration Apache File
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster#example.com
DocumentRoot "C:/xampp/htdocs/example.com"
ServerName example.com
ServerAlias www.example.com
ErrorLog "logs/example.com-error.log"
CustomLog "logs/example.com-access.log" common
</VirtualHost>
Hosts File from Windows
127.0.0.1 www.example.com
After those step i still kept on struggling how to make it work for my phone or the laptop of my dad just to get the real website imagination
Because even i changed some details it only worked for another device if ive called the index.php in my dev-folder but it was only displayed as RAW HTML
I really hope you could help me with that thanks for paying attention
Kind regards
NateDev

"www" issue on WordPress site

I just starting with WordPress, I am using Digital Ocean and a domain. I went to WordPress setting and added "www" to website name as it was naked before, the site stopped working and shows nothing now. How to fix this?
After changing the site URL and home URL to www, you need to add ServerName as www.yourdomainname.com
Assuming you have a single host.
sudo nano /etc/apache2/sites-available/000-default.conf
Change the file as below.
ServerName www.yourdomain.com
ServerAlias yourdomain.com
Now you need to have 2 A records with hostnames # and www pointing to your IP in your DNS.
Hope this will resolve the issue.
Who did you buy your domain through? You should go to your settings there and change your DNS settings to do a www redirect for you. Then just make sure the box is listening for the site name with the www prefix.
Usually changing the domain name for a site isn't quite this simple, although adding in 'www' shouldn't cause too much grief I'd think.
However, to get things back up and running, you'll want to get into your site's database (via PHPMyAdmin or something like that) and open the wp_options table. In the first page of that table, you should see an entry for site_url, which you can edit and remove the 'www'. That should at least get you back up and running. Then we can sort out what the other issue is with the subdomain.

Wordpress Directory Switch Issues

I recently set up a digitalocean account with wordpress pre-installed. When it is pre-installed, the directory structure begins in the root (var/www/html/). I wanted to change this, so i moved the files into a new directory (/var/www/html/viralnewz) and changed the wp-config files to represent this (they no longer point to the http://178.62.87.202/ but instead to viralnewz.co.uk, which in turn will point to viral newz directory (/var/www/html/viralnewz). This is set up with a virtualhost, and works fine for the front-page and the admin. But when i try and view others pages, i get a 404 not found. I'm assuming theres an issue with the wordpress setup because it can't find the correct page, however i'm unclear how to actually solve this issue.
Apache conf file
<VirtualHost *:80>
DocumentRoot /var/www/html/viralNewz/
ServerName viralnewz.co.uk
# Other directives here
</VirtualHost>
Additionals to wp-config.php
define('WP_HOME','http://viralnewz.co.uk/');
define('WP_SITEURL','http://viralnewz.co.uk/');
If i've missed any other information that could be beneficial, please mention it and i'll do my best to find it.
Chris
I think your problem can be related to url values stored in DB.
You can migrate safely using this tool, that permit to find and replace the urls stored in DB.
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Can be also necessary update .htacess file: normally is enough enter in permalink settings and save again the structure of permalinks.

Wordpress site broken after Apache vhost setting

I had a working wordpress site accessible by http://localhost/wp corresponding to the directory /Library/WebServers/Documents/wp. Since I desired to have my wordpress site accessible by http://wordpress without moving the wordpress directory I decided to set a new host in /etc/private/hosts where I added the entry:
127.0.0.1 wordpress
Then I was able to access the site with http://wordpress/wp. To avoid the 'wp' part of the URL I decided to use Apache virtual hosts by adding in /etc/apache2/extra/httpd-vhosts.conf the following block:
<VirtualHost *:80>
DocumentRoot "/Library/WebServer/Documents/wp"
ServerName wordpress
ServerAlias wordpress
ErrorLog "/private/var/log/apache2/wordpress"
CustomLog "/private/var/log/apache2/wordpress" common
</VirtualHost>
Then I restarted Apache and trying to access the site by using the URL http://wordpress I was able to see the written part of the first page but no images and all the links where broken.
Checking out the links I see that the URL they are pointing still contains the 'wp' part I was trying to avoid.
Any suggestion?
Yes, in your database, all of the URLs still have the /wp/ in them. Changing your Apache config did not change this. The easiest way to do this is to use wp-cli (http://wp-cli.org) to do a search and replace on your WordPress database.
BACKUP YOUR DATABASE BEFORE PROCEEDING
wp search-replace 'http://wordpress/wp/' 'http://wordpress/' --dry-run
Assuming you have installed wp-cli and named it wp, the command above will show you all the changes it would make to remove the /wp/. from your URLs.
Once you are happy that it is changing the correct things, remove ``--dry-run` and it will actually make the changes for you.
wp-cli is a powerful tool. We use it for a lot of tasks at http://getpantheon.com and I use it to do a lot of maintenance work on all my personal WordPress sites.
HTH,
=C=

What is the best way to implement a blog on a website that uses the Symfony framework?

Our company website was built using the Symfony framework. We want to add a blog to it in a subdirectory (so the website will be www.ourwebsite.com/blog). What is the easiest way to do this?
Ideally, I would like to use WordPress as it is what I am most experienced in, but switching the entire site over to WordPress is not an option. One option is to create a subdomain for the blog (blog.ourwebsite.com) but we are investing a large amount of money into SEO and our website already has decent rankings. We would like to use a blog to further increase the rankings of our website, and I feel that having it in a subdomain would slow us down from reaching our goals based on the limited amount of research I've done.
I would solve this at the webserver level. Suppose the Symfony app lives at /var/www/example.com and the Wordpress blog at /var/www/blog.example.com.
For Apache, something like this should do:
<VirtualHost example.com:80>
DocumentRoot /var/www/example.com
ServerName example.com
<Directory /var/www/example.com>
# Your Symfony config here
</Directory>
Alias /blog /var/www/blog.example.com
<Directory /var/www/blog.example.com>
# Your Wordpress config here
</Directory>
</VirtualHost>
See Alias directive for details. If you get the idea, it should be straightfoward to adapt this to other webservers, such as Nginx, if you're not using Apache.
Or you can just go with: symblog.co.uk if you are willing to go a little more into the code.

Resources