HTTPS on dev server - issues - wordpress

I copied a live woocommerce site back to the dev server. The live site uses https. So when I tried accessing it on the dev server, it redirected me to the live site. I figured the issue was the .htaccess file. I tried editing it, but the file is encrypted. So I just removed it all together. That stopped the redirecting, and I was able to access the front-end of the dev site. However when I try to access the wp-admin or wp-login.php I get a 404. I also noticed that the broswer changed from http to https. So there's something still trying to make the website run under https.
What I've tried:
I deactivated woocommerce plugin (by renaming it) but that didn't
help.
I also searched in the database for instances of https:// but I
could not find any that related to the website.
I also found and removed a cert.html file in the root which I think
it's related to the https certification, but I still can't access
the backend.
And last, I tried to add a new .htaccess file with the basic
wordpress permalinks in it, but that just gave 500 server errors.
Can anyone give some pointers where to look? Or what could be causing the browser to use https, instead of http.

It looks like you need to change your site URL to point to the right place. Since you can't log in (it'll redirect you to the wrong site URL), you need to change this in your wp-config.php file (see this link for more info):
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
After that, and hopefully with the default wordpress rules, you should be able to log in to the admin pages.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
The above assumes that your wordpress site is at /.

Related

Moving WordPress from Live to Localhost MAMP

I am trying to back up my Wordpress website and want to test my website locally, without a SSL certificate. I have installed MAMP but I am facing some problems to make it work.
When I start the apache server and go the localhost, my homepage does show up but the CSS doesn't load and I get a bunch of errors regarding a cache plugin.
But the biggest problem I am facing is that whenever I go to another page, my local website immediately tries to load a HTTPS page and goes to my live website (even when I specifically mention a HTTP link).
I have tried changing the .htacces file with the following code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
I have also changed the database homepage URL from https to http in wp_options but that only fixed the index page but not the other pages of my website.
My apologies if my question is still unclear, I'm kind of new to this so any help would be appreciated.

After WordPress migration only home page loads everything else returns a 404

Getting started with a droplet on Digital Ocean, so far it's been a fun process. Now I want to begin migrating my site, so I set everything up and created an index.php to where to my root dir as a "construction" page for now. I'm setting up WordPress in a sub-dir and moved all of the contents via all-in-one WP Migration which has always worked perfectly for me.
I've given every dir and file inside of root/public_html (WordPress installation) rwx and atm ownership has been changed to www-data. So I got to loadup my site which atm would be something like <ip address>/public_html and I log in and I am propmted with the wp-admin screen. Everything is working, media files are uploaded, theme is there etc.
When I go to my home page, all the images load but I immediately notice the admin bar at the top, the wp-glyphs aren't loading and I'm getting those weird squares when your computer/phone doesn't know what it's trying to look at. Also any front-end page other than my home returns a 404. My homepage again is accessed by <ip address>/public_html so you would think my about page would be <ip address>/public_html/about, which is where WordPress is sending me to when clicked, but I receive a 404.
I've spent probably 4-5 hours now trying to figure this out and eventually turned to a guide that walks you through it but nada so far.
Can anyone offer a suggestion?
EDIT
I'd like to add that I followed WordPress's instructions on modifying the .htaccess file. I'm assuming it goes in the subdirectory correct?
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /public_html/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /public_html/index.php [L]
</IfModule>
Just as a reference for myself and anyone who might stumble upon this.
Solution
The answer was that apache was not configured correctly to read .htaccess files. If you are experiencing the same problems and have set up your own VPS, go to apache.conf, etc/apache2/apache.conf and find the correct <Directory></Directory> directive that corresponds with your website directory. Inside you should see an option that reads AllowOverride None. Change this to AllowOverride All.
If this is not the solution for you, at least it's another step out of the way.
Are you able to access wp-admin
If yes then go to dashboard->setting->permalinks
and update the permalink and the problem solved
Access your dashboard by logging in wp-admin then access settings then permanent links, Change them to any of the provided styles save the change it again to your preferred one. This will work well.

WordPress in base.example.com and accessible from example.com give me path issue in Hostgator

I have a WordPress installation at Subdomain. I wish to have the website display the site at example.com
The WordPress folder is located at base.example.com and the path is public_html/folder1/base.
If I run the site from the subdomain with home and site url pointing to base.example.com everything works fine. If I change the second url to my root example.com copying index.php (changing the path) and .htaccess to public_html/ I get the following issue:
.htacces is not writable from wordpress
tons of redirect issue
admin bar disappear (solved here Admin bar doesn't appear on the front-end of a WordPress website)
if I open the customizer I get errors (TEMPLATE ISSUE... with default wp themes everything works)
Using USERPRO Plugin to manage my user after login I'm redirect to the default wordpress login page (that means there is something missed up in url redirect) EDIT: This is the path on the login page that appear after userpro login: http://base.exaple.com/wp-login.php?redirect_to=http%3A%2F%2Fbase.example.com%2Fwp-admin%2F&reauth=1 ... I'm still waiting for an answer from the author
sometimes when I press logout it just reload the admin page.
when I visit base.example.com I'm not redirect to example.com... is this right? it shouldn't redirect me instead?
Are 5 days that I'm trying to solve it so I also wrote to hostgator support because I think I did everything in the right way but they just say they can't support issue wich came from customization....but this is not a customization, is just making work a simple wordpress installation from a subdomain!!!
Hope you can help me!
EDIT
.htaccess (both in public_html/ and in public_html/folder1/base are the same)
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %.{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
index.php (in root)
require('./folder1/base/wp-blog-header.php');
index.php (in public_html/folder1/base)
require('./wp-blog-header.php');
EDIT 2
I just get some 404 errors...
Updated question 4,5,6
Your suggestion doesn't work. 301 redirect force wordpress to find his files in public_html instead the installation folder and obviously it can't find anything giving me an error. I've also changed the url form example.com to base.example.com but nothing!
I've tried to install wordpress in a simple subfolder and all the issue disappear but as I'm stubborn I want to achieve to make wordpress working in a subdomain instead a subfolder...
.htaccess being writable is not unusual, being that the site is in a
different directory.
Tons of redirect issues isn't a question, I would need an error to help you solve that problem.
Solved by my answer at Admin bar doesn't appear on the front-end of a WordPress website.
This isn't a question, I would need an error to help you solve that problem.
You should contact the UserPro support team via their CodeCanyon account for support with their product.
What error occurs when you are unable to logout? I would need an error to help you solve that problem.
This is normal behavior. You can change this through a 301 redirect in your .htaccess within the root of the subdomain folder (not the root of your website). This code excludes /wp-content/* (for uploads access, plugins access, theme file access, etc.), /wp-admin/* (for admin access), and /wp-includes/* (for important WordPress includes access). Try this code and see what happens:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/wp-content/
RewriteCond %{REQUEST_URI} !^/wp-admin/
RewriteCond %{REQUEST_URI} !^/wp-includes/
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

Fishpig Wordpress Magento - http://example.com/blog resolves to www.example.com rather than www.example.com/blog

I have a working Fishpig Wordpress Magento instance on a production server.
All the green ticks show it has succesfully configured and when visiting
http://www.example.com/blog
it works. However when I try and and visit
http://example.com/blog
it sends me back to the magento home page at www.example.com .
I have tried setting the url in wordpress to both http://example.com/blog and http://www.example.com/blog but in both situations it always sends me to the home page at site.com.
This is a concern because most experienced web users will not type www when trying to access a location.
My htaccess is as generated by Wordpress and looks like
DirectoryIndex index.html index.php
<IfModule mod_rewrite.c>
#wp generated
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Please not the wordpress site files are located at site.com/wp and it is the fishpig extension which arranges the direct from the non existent /blog path.
First of all, to start of, one way to resolve the issue is to simply make your Magento website DEFAULT to not have the www. in the url.
In Magento, go to System > Configuration > Web.
In the "Secure" and "Unsecure" tabs, find "Base URL."
The value should look something like this:
http://www.site.com/
Replace ALL references to the domain so it shows:
http://site.com/
Unfortunately, there may be a lot of appearances of it throughout the site. You'll need to do the same thing elsewhere on the server.
If you really want your site/blog to say www., though, you'll have to properly forward the .htaccess file in Magento. I'm not too keen on how Magento's .htaccess file works, but I do know how to forward a url and keep all of its additional pages as well (however, Magento's setup may interfere).
The code should look something like this:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^site.com$ [NC,OR]
RewriteRule ^(.*)$ http://www.site.com$1 [R=301,L]
Again, I don't know how well this will work with Magento's set up, but I've successfully used the above code to redirect url's to the correct url I want. That code above was actually used on a wordpress site, though.
Check for Rewrite rules in Magento's .htaccess file and try putting this above it. Be careful, though; it is VERY easy to cause 500 internal server errors if you mess up the .htaccess file, so always keep a backup.
Try this out and I hope it helps.

Why Won't Fishpig Set the Magento Blog URL Correctly?

So, a client of mine has this Magento site set up:
http://kharmakhare.com
I have actually asked a question about this site before. This time, they want a blog set up at:
http://kharmakhare.com/blog
Yes, there is one already there. They want to replace that AW Blog with a Wordpress blog integrated into the Magento theme with Wordpress. There's just one problem; I can't get the url to change at ALL.
No matter what I do, the blog always appears at:
http://kharmakhare.com/wordpress
I try to disable the AW Blog and test the new one at:
http://kharmakhare.com/blog
But nothing happens. The above url simply redirects to the main site.
All of my Wordpress Integration settings are green (except for "improve your blog"). If I disable Wordpress Integration in the settings, the /wordpress directory STILL appears.
In Wordpress, the site url is set to /blog. The wordpress url is /wp. Whenever I try changing the permalink settings Wordpress fails to create the .htaccess file, so I did it manually... but it always uses /blog in the settings:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
Not that it matters much. Even with it set to:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
</IfModule>
It still doesn't work.
This has been a real, real pain to set up. The documentation says its easy, everything I've read says its easy. It just plain won't work for me. I even tried reinstalling the plugin. Then I tried uninstalling and reinstalling the plugin. I also tried (before this) uninstalling and reinstalling wordpress. Nothing works.
I can NOT delete the AW blog without having the new blog to replace it. I can disable the AW blog temporarily, but I can't delete it. Is there anything that I'm missing?
Any help would be greatly appreciated.
Firstly, upgrade WordPress Integration to the latest version and uninstall AheadWorks Blog extension.
Secondly, I assume that you have installed WordPress in a sub-directory other than 'blog'. For this example, I will assume you have installed it in 'wp'.
To make your blog viewable on /blog, set your Blog Route as 'blog' and your WordPress path as 'wp'. Next, login to WordPress and select Settings > General and change the second URL option (labelled Site address (URL)) to http://www.yourmagentourl.com/blog
You should now be able to view your blog at the /blog URL.
Finally, if WordPress is installed in /wp and visible at /blog, your .htaccess file should reference /wp/ and not /blog
The solution is easy. First fully disable AW_Blog. Don't just disable this via the configuration or via System > Advanced. Either fully uninstall it or delete the app/etc/modules/AW_Blog.xml file and then refresh the cache.
The AW_Blog module uses - rather selfishly - 'blog' as it's frontName. The frontName takes precendence over the dynamic routing system used in Magento WordPress Integration so while AW_Blog is installed, you can't use 'blog' as your WordPress URL.
With AW_Blog fully uninstalled, enter 'blog' as the blog route in the extensions configuration. Finally, login to the WordPress Admin and select Settings > General. Here you will see 2 URLs. The first URL should be the true WordPress URL (if WordPress is installed at /wp then this should be the /wp URL). The second URL should be the integrated Magento URL (eg. the /blog URL)
The WordPress .htaccess file has no effect as this only runs when actually accessing WordPress and isn't ran when accessing Magento.
Hi this is more of a question clarification (disclaimer) as I am having what may be a related issue.
What happens when you visit http://WWW.kharmakhare.com/blog rather than the shorter url? For me at the moment- www.magento.com/blog resolves correctly whereas magento.com/blog sends me to the home page.
Also, have you tried setting the full path in the wordpress settings? Your question indicates you have set it to /blog rather than the full http://kharmakhare.com/blog ? I believe it should include the full file path.
Ok, I think this must be a bug in the plugin. The ONLY way I could get this to work is to edit the Fishpig plugin's core so that the default route is "blog."
Not an ideal solution, but at least it works. This should not be such a problem, though, the plugin should work as its intended without modifying the core files.
when dealing with the Wordpress plugin, be sure to clean magento cache (better disable it during editing) and clear your browser cache as well.
Changing routes around between magento and the Wordpress plugin, quickly becomes a nightmare when dealing with invalid caches.
Also check your URL rewites as sometimes as a last resort, a webshop owner will use this to make things work.

Resources