301 redirect error with wordpress and apache - wordpress

I've recently migrated a database from windows using bitnami (apache and wordpress) to a linux server (apache and wordpress). I'm able to access the website wp-admin, but every time I try to access the main site it repeatedly returns 301 errors.
I've tried disabling the .htaccess file (deleting, commenting everything out), but it still gets directed. I've disabled all plugins. I've looked into the themes I'm using but they don't have redirect url's like I've seen in other posts.
I'm wondering if the issue might be in how bitnami structures itself. the main documents are stored in website/wordpress/htdocs, whereas linux wordpress seems to store it directly in wordpress.
I've set sites-enabled home directory to
sitelocation/wordpress/htdocs
I've also set the wordpress address and site address to
http://website.com:80
What do I need to do to prevent the redirects, or set it up to work correctly?

if you haven't change your Site URL then.
Please change the Site URL and Home URL from database in wp_option table.
You need to mention new url in both section..

I had a trailing / on my siteurl which led to it not working. After removing that it worked.

Related

Why is WordPress redirecting to localhost

I have a WordPress website running on a server, using a docker container (with port forwarding 8001:80), and an Apache server with proxypass to redirect "demo.travel-itineraries.com" to "localhost:8001".
My problem is that WordPress redirects to localhost instead of using the website URL I specified.
My WordPress configuration doesn't contain any "localhost" occurrence (I tried SELECT * from wp_options where option_value like '%localhost%'; and there is no occurrence of localhost)
The WordPress address is set correctly
The homepage is working fine (http://demo.travel-itineraries.com/) but the second page isn't. If you check the link in the navbar, it's a link to "http://demo.travel-itineraries.com/les-joyaux-de-ladriatique-a-bord-du-pacific" but WordPress redirects to "http://localhost/les-joyaux-de-ladriatique-a-bord-du-pacific".
I checked with curl, and the RedirectedBy header is set to "WordPress".
Do you have any idea why it keeps redirecting?
Thanks
Worth a try: There is an extremely old bug in Wordpress which causes problems in permalinks (i.e. pages are not found) after moving the site to another server or directory even though everything is set correctly.
And there's the also-extremely-old fix for it to go to the backend, open the Settings > Permalinks page, change any one little detail, change it back again and click "save changes". And I've heard from others that often it's even enough to just open that Permalinks page without changing or saving anything.
I just had that again in the current version (5.8.3) – same problem, same fix. I really wonder why that bug still exisits...
I noticed Yoast is installed, the premium version of that plugin automatically creates redirects, you can check those by going to SEO > Redirects in the back-end.

Changing URL Wordpress- still not working despite checking/editing database

As much as may sound like a broken record - I changed the URLs on my WP site, and now I get a 404.
What I wanted to do:
Change site URL from www.SiteA.com to www.SiteB.com
All WP files were at the time in another directory in the same hosting account. I needed them in the root directory, accessible by www.SiteB.com
What I did:
Backed up locally and remotely - Database and files.
Edited URL's through dashboard on WP - got a login error afterward, but seemed to do it anyway.
Moed ALL old site files from root to backup folder.
Moed ALL wordpress files from original directory to root directory.
Then I got a 404 error and was unable to access WP-admin or login through the new or old URL.
What I tried to fix the issue:
Noticed http should be https - changed this in 'options' within phpmyadmin, both at 'siteurl' and in 'home'.
Still 404
Then I tried defining the db_name in the wp-config file.
Still 404
Then I gae up, changed the URL's back using myphpadmin, and moed the filed back to their original directory. Now I can login to WP as usual and eerything is fine.
Why can't I access the site when I moe it into the root directory - I thought I had all the steps right!
Thanks in adance for any help
oh..and apologies, my keyboard is missing a few keys :(
Wordpress stores url/permalinks on database field values as well, changing only the configuration files will not be enough.
I am pretty sure there are other options, on my case i use often perform Wordpress website migrations, and the following tool becomes really handy when search and replacing domains on the database records.
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Hope it helps.
Jose
This happened to be an SSL issue where the host for our SSL certificate was conflicting with the stylesheet somehow. 0_o

CNAME links to WordPress blog but redirects cgi-sys/defaultwebpage.cgi

I've got IIS hosting site(www.site2.com) and wanted to add wordpress blog site on this website, but wordpress is PHP based so I used a tricky way.
I've got PHP hosting site(www.site1.com) so set up self-hosted wordpress blog on this site then adding CNAME on site2.com domain, I believed it should work.
So, installed wordpress in PHP hosting site(cpanel hosting) and create blog site on this wordpress, the url is www.site1.com/blogb. Then created subdomain from cpanel(blogb.site1.com) which linked to www.site1.com/blogb as root folder.
When I go to blogb.site1.com, it's working so good.
One last thing what I did is adding CNAME from site2 zone manager.
blog.site2.com -> blogb.site1.com
I think this should work because blogb.site1.com is working properly.
But when I go to blog.site2.com, redirected to "/cgi-sys/defaultwebpage.cgi" page then showed "SORRY ... If you are the owner of this website, please contact your hosting provider" message.
I cleared cache from my browner and tried from other browser but didn't work.
And added rewrite rule on .htaccess file on site1.com root folder but nothing worth.
I checked site URL from wordpress settings page, the site address(URL) was "blogb.site1.com" which was correct.
I believe if destination url of CNAME is working, the CNAME should work.
But when I try to access a file in destination folder using this url, blog.site2.com/readme.html, returns 404 not found while blogb.site1.com/readme.html is working.
So, CNAME(blog.site2.com) seems be pointing wrong directory.
Is there anything I missed or did wrong?
Thank you,
B

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.
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.
Go to wp-admin - settings, and change site url. Than flush permalinks by resaving settings.
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.

Wordpress - after upload on server 404 on all pages, no css

I have developed a wordpress based site using xampp 1.8.3. On my local machine all is wordìking fine. On the server I am using php 5.4.12.
On the server I copied the site on a subfolder name site, wich is the same subfolder name I had in xampp/htdocs. Then i changed all occurances of localhost to mydomain.com with the searchreplacedb2.php script (http://interconnectit.com/products/search-and-replace-for-wordpress-databases). I am confident that the tool is working properly and the issue does not depend on it as I have used it several other times with succcess.
Therefore since on my local machine the site was in localhost/site, on the hosting server is on mydomain.com/site.
The proble is that accessing the site home page produces a wordpress managed 404 page with no css being loaded. The title, menu and other site specific text is displayed, therefore the db is being read correctly. Trying to access any page other than the home page gets a webhost managed 404 page. This happens also if I try to access page through non symbolic urls, ei. mydomain.com/site/?page_id=5; therefore it is should not be a redirection issues.
what can be the issue? How can I proceed in troubleshooting it?
Thanks, in advance for your time.
You need to double check everything, first:
Flush the rewrite rules by visiting settings->permalinks then try your pages. Then try:
List item login to phpmyadmin for each domain, check out the database... options table... verify the "siteurl", and "home" columns. make sure they match the respective domains. Then try:
List itemCheck the DNS zone template. Could very well be possible DNS conflicts.

Resources