I have a domain that works like a charm www.mydomain.com. Recently I wanted to add a subdomain like myotherweb.mydomain.com, so i add my subdomain from my cPanel and upload my Wordpress (works on XAMPP) to subdomain directory.
After that I try to open myotherweb.mydomain.com; the result is a blank page.
So I try to open myotherweb.mydomain.com/wp-admin and the Wordpress login page shows up, and I can log in to my wp-admin dashboard page. But when I try to edit a page, the edit page is blank.
What is happening in this case?
Probably this case happens if transfer of wordpress is not proper or .htaccess is not proper set.
.htaccess settings for subdomain
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
For more reference you can check on Wordpres Codex htaccess
Transfer wordpress from one domain to another
This is most common problem happens to many when transfer from one domain to another.
Update Your wp-config.php File
define('WP_HOME','http://myotherweb.mydomain.com');
define('WP_SITEURL','http://myotherweb.mydomain.com');
Update urls in sql
For this open your exported database in text-editor like notepad+, sublime or netbeans, and do find and replace urls mydomain.com to myotherweb.mydomain.com and try import on live again,
or if you are not familiar with this or this is boring task for you then you don't need to panic, there is one plugin available to do this task for you very easily.
Install Wordpress duplicator plugin in your xampp and use as instruction given on plugin site or this reference site, after that upload new wordpress site generated by plugin on your subdomain.
Hope it will work for you.
I have solved this problem by install wordpress from my cPanel, and copy this setting from new Wordpress installation wp-config :
AUTH_KEY
SECURE_AUTH_KEY
LOGGED_IN_KEY
NONCE_KEY
AUTH_SALT
SECURE_AUTH_SALT
LOGGED_IN_SALT
NONCE_SALT
then replace my Wordpress project wp-config, and it's magic.
I don't know why it's necessary.
Related
I have an SSL sertificate, so http -> https is a must (as a precaution). I intend to have multiple subdomains, i.e. subdomain1.example.com, subdomain2.example.com, currently there is one subdomain that works without any issues. I'm using a multisite Wordpress setup, that was installed (purposely) in one subfolder. The multisite setup is for other languages. The current server folder layout is as follows:
public_html
backstage
subdomain1 (folder for the subdomain)
frontstage
wp-admin
wp-content
wp-includes
(the rest of the WP files)
index.php (a test file, that shouldn't load if the redirection is set up properly)
Currently, the www.example.com/frontstage/ opens the main WP site, this is fine. I can access its wp-admin without issues. www.example.com/frontstage/en/ shows a 404 page, this is not fine. www.example.com/frontstage/en/wp-admin/ opens the dashboard fine for the other site.
I want to retain the stripping out of index.php from any links (to keep the links clean).
There are two "simple" things to configure properly:
I want to retain the server folder structure as it is, but having the "frontstage" folder skipped, so that when you visit www.example.com, the main WP site loads (and in the case someone would load www.example.com/frontstage/ it would redirect to www.example.com). Naturally, the "shift" needs to allow for the www.example.com/en/ to open the secondary website (any any other language sites that may follow). Ideally without rewriting all the links within the WP sites.
Currently the /en/ site doesn't load its root. The demo posts and pages load fine.
My current .htaccess on the root level looks like this:
# disable index.php from urls
RewriteEngine On
RewriteBase /
<IfModule mod_rewrite.c>
# redirect index.php requests
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
# force https and www
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
# move wordpress one level up
# allow subdomain
RewriteRule ^backstage\/subdomain1\/?(.*)$ "https\:\/\/subdomain1\.example\.com\/$1" [R=301,L]
Any help with this is highly appreciated (I'm still learning the htaccess bits and tricks and this one is truly beyond me). What am I missing in the above code to get it right?
When I have WP installed within a subfolder, I just goto Settings => General and change the Website URL by removing the subfolder.
Afterwards I move the file index.php one folder level up and in your case, would change it to:
require( dirname( __FILE__ ) . '/frontstage/wp-blog-header.php' );
Does this solve your problem?
Find a detailed description how to move WP to a subdirectory on this site - You can find a detailed description about putting Wordpress in a subdirectory on the following website https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
Regarding a redirection from http to https - this is possible within the .htaccess. Much better, in my opinion, would be an alias on the apache (this usually should be done by your hoster).
The difference:
The htaccess redirect goes back to the user and then again to the server, which costs some time. The alias is - as far as I know - redirected on the server.
if you want to force https, you can do it with the following entry.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
Okay,
I have a wordpress system https://example.com, everything works fine. Basically I also have zen cart installed in the system. https://example.com/shopcart/ is the url for zen cart.
I am trying to upgrade zencart to the latest version. For which, I have backed up the files and database.
I have uploaded the latest version zencart files to https://example.com/test/ and when I try to load https://example.com/test/zc_install/ I am redirected to a 404 page.
The <title></title> of the 404 page says 'Nothing found for Test Zc_Install'. I am sure wordpress is looking for an article by this name. I have tried many solutions, but it is not working.
Below is my .htaccess:
`<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>`
The system uses permalinks. The permalink is set to custom structure: http://example.com/%post_id%/%postname%/
I know that wordpress loads the root index.php file first and prepares the query. Is it possible to temporarily stop wordpress behaviours and allow me to access the URL https://example.com/test/zc_install/ ?
Any help would be extremely appreciated. Thank You.
The WordPress apache rewrite is catching all of your requests when they come into the website root directory.
You could add the following to the top of your Rewrite Rules:
RewriteEngine On
RewriteBase /
# add this line to ignore all re-writes within the TEST folder.
RewriteRule ^test - [L,NC]
This will ignore all requests which contain the test/ directory. I would then suggest that you add a separate .htaccess file within your Zen base folder to handle any smart SEO mods etc from there, rather than cluttering your main .htaccess file if possible.
I have installed wordpress in main domain (fewinfo.com) and its running successfully. now, i have installed wordpress in subfolder (fewinfo.com/wp) but when i check post inner page it shows 404 error.
I have updated .htaccess using below code but not working and also I have tried without "wp" that also not working.
NOTE : Website have hosted in Godaddy
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
</IfModule>
# END WordPress
Go to Settings » Permalinks, and simply click on Save Changes button.
You can replace or export data using Wp Migrate DB.
Easy to replace any url in your current database without lose any data or serialization issue.
Changing the Site URL multiple ways.
After Change Url Update:
Go to
Settings » Permalinks
Update permalink.
I decided to switch to a single website to multi-website (called network in wordpress). I followed this documentation :
- https://codex.wordpress.org/Create_A_Network
First, I followed this documentation
- https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
In order not to have my files in the root of ~/public_html. I called the folder : WordPress and I changed my .htaccess.
At this point everything worked fine.
I followed the doc till the end, so I added :
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'mysite.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
And I replaced the old ~/public_html/.htaccess by
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) WordPress/$1 [L]
RewriteRule ^(.*\.php)$ WordPress/$1 [L]
RewriteRule . index.php [L]
All this code is code that wordpress told me to write.
The problem now is that when I go on the main page : mysite.com I see :
How I can modify my htacess (or other) to view the main page of the website ?
Thanks
edit: this url mysite.com/wp-admin works
Multisite is meant to run multiple blogs in the same WordPress install. Your files should still be in the public_html directory - unless you want your site be accessed via domain.com/WordPress.
So, all of your files should be directly in public_html. Then you can go back to your dashboard and finish setting up Multisite. You can create new websites under Dashboard -> My sites.
If i understand correctly, when you enter mysite.com/WordPress is what you want to appear when you enter mysite.com? If yes, then:
Verify the Profile In your Administration Panels go to Settings >
General . Here you will verify that the changes you made in Changing
the URL above, are correct. Verify that the reference in your
WordPress Address (URL) contains the new address. Verify that the
reference in your Site Address (URL) contains the new address. If you
have made changes, click Save Changes.
from https://codex.wordpress.org/Changing_The_Site_URL
I've been facing a problem with my WordPress app for over a month now and I couldn't make it work. I thought it was a problem with DNS server, then I thought I had a problem of caching, then a problem with the application (the wordpress redirecting it wrongly) and now I believe I have a problem with .htaccess
If you go to www.porta8080.com.br my website work fine, but when I remove the WWW it makes a redirect loop. Somehow it is not changing the URL, so it reloads the page and it's redirected again and again and again. I checked with cURL and same happens.
If I remove the .htaccess and change the permalinks settings to Query Strings it works. But anything that relies on URL rewriting (friendly URLs and stuff like that) fail.
Since I'm using OpenShift I think my conditions and rules are wrong. I'm using the default WP .htaccess and I added some things to force the WWW
This is my htaccess at the moment
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
First of all to enforce "www" in WordPress, there is simple, non-htaccess based solution.
i.e. Keep using standard htaccess file of WordPress and for www version. Go to WordPress Settings -> General
There you have two fields for your site's url: WordPress Address (URL) & Site Address (URL) , make sure both urls have http://www version in it.
Then WordPress will enforce www version for all Urls of your website.
This may solve your htaccess and redirect loop issue also?