user2437742
user2437742

Reputation: 93

Wordpress links pointing to the wrong domain

In wordpress, how can I change where the links are pointing to without changing the server name or adding redirection?

My main site is a rails app at www.example.com.

I have the wordpress blog on a separate server at blog.example.com/blog

I have a reverse proxy on the primary (rails) server that takes any url that ends in /blog/ and then serves up the blog content. (That's all behind the scenes -- the user never sees the blog.example.com domain)

Currently, I can access the blog via the reverse proxy at www.example.com/blog, but the problem is that the urls on the blog point to blog.example.com/blog (wrong) instead of www.example.com/blog (right).

I've tried changing the urls in wp-config.php, but whenever I change those it breaks something.

Upvotes: 1

Views: 5039

Answers (3)

user2437742
user2437742

Reputation: 93

I eventually figured it out. Here's what I did.

1) Got rid of the Bitnami wordpress image (on Amazon) and reinstalled wordpress fresh, from scratch, on EC2. Bitnami had a bunch of magic behind the scenes that was making it hard for me to figure out what was going on.

2) Via wordpress admin changed Site Address (URL) from http://blog.example.com/blog to http://www.example.com/blog Previously, I had been changing this in the wp-config.php file, but I am pretty sure that doesn't do the same thing. So I needed to change it in wordpress admin. However I needed to keep the Wordpress Address the same. Found out that the Site Address governs the urls displayed in the theme, whereas the Wordpress Address is the server hostname. I'm using a reverse proxy which is why this was confusing.

3) To enable pretty permalinks behind the reverse proxy I changed the permalink settings in wordpress admin, then I updated .htaccess according to its instructions, then I modified /etc/apache2/sites-enabled/000-default changing AllowOverride None to AllowOverride All. Need to do this to enable mod_rewrite to work on virtual hosts.

Upvotes: 1

The Humble Rat
The Humble Rat

Reputation: 4696

You don't really provide a mountain of information. But you will need to check this area of your dashboard

http://www.steveovens.com/wp-content/uploads/2011/09/wpid209-Check__Force_HTTPS_in_site_address__Wordpress_address.png

to make sure the information is

http://54.235.249.193/blog/

In both fields.

If you still have issues try changing your permalink setting to a new setting save it and then change it back again and save.

http://www.webmikesites.com/wp-content/uploads/2013/09/permalink-settings.png

If you are unable to access the dashboard of the site on the address

 http://54.235.249.193/blog/wp-login.php

As it redirects you to the other domain.

Then you need to likely change the two fields mentioned earlier siteaddress and wordpressaddress via the database. Find the table in your database wp_options or yourtableprefix_options and edit the fields option_value where the option_name is siteurl and home to have the address

 http://54.235.249.193/blog/ 

Also if you are just starting using a webserver. You may need to make sure your files are writable by the webserver.

Upvotes: 0

user796443
user796443

Reputation:

Go to wp-admin - settings, and change site url. Than flush permalinks by resaving settings.

Upvotes: 0

Related Questions