Deploying wordpress to temporary url on live server with subfolder - wordpress

I have a wordpress site that I was working on locally and on a production server. The site is preparing to launch and I have to show the client that it works on the live server before the domain is transferred over. Unfortunately, the temporary url given to me is http://[ip address]/~foldername, so the site isn't working properly because it is looking in the wrong places. The homepage works fine after I put in the site_url and home_url in the admin, but clicking to interior pages is not.
How can I get it working with this temporary url but also still have it work when the domain switches over. I imagine this can be done with htaccess but not sure exactly what to do.

All I had to do was put in the subfolder in the htaccess file.. so it looked like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /~subfolder
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /~subfolder/index.php [L]
</IfModule>
# END WordPress

Related

Can't Access Current Wordpress Web Pages

I'm uploading my website to Apache on CentOS on Google Cloud and I can't access all of my existing web pages, I get the following error:
Not Found
The requested URL /home was not found on this server.
However, when I create a new page I can access it no problem.
I've uploaded my files again, and double checked all the database stuff checked out and I've checked my .htaccess file. I can't figure out what's going on.
Make sure that the .htaccess file contains the following content:
# 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
You should also check if .htaccess is actually working. The easiest way to check this is to intentionally break it, by adding some text to the file. If .htaccess is working you should get an Internal Server Error page.

Changed the URL and ROOT. Main Page won't load. Wordpress

I am trying to redesign a website from a friend and it's chaotic as hell. Now I am stuck a bit.
The old domain it something like http://www.website.com/folder/
I am trying the get rid out of the "folder", so I changed the setting in the wordpress setting and the root in the web-provider. The whole website is working fine, also the Wordpress admin area. But if I'm trying to get into the "home" page, it won't load - or it is loading endlessly.
Do you have any idea how I could fix it?
Regards and thanks,
Natts
A piece often forgotten is the .htaccess file (found in the root of your WP install); I especially suspect it because you're going from a subfolder to no subfolder.
Back it up, then override it with the default WordPress values (or delete it and go to Settings -> Permalinks in WP Admin)
Default .htaccess:
# 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

wordpress site not starting

I have moved wordpress site to production server from test server. I have done database, code configuration changes. The strange problem i am facing is if i call my website adding index.php then only it shows the site.
http://www.suziesellsaz.com/index.php
If i directly call using domain name it is not working
http://www.suziesellsaz.com
I have thought problem may be because of .htaccess so i have deleted .htacess and saved permalink and it creates following .htaccess but still no luck.
# 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
Can some one help me solving the issue?
Please check if under Settings > General settings
Both the urls i.e Wordpress Address and Site Address are same.
Last time I had this issue when they were different. Changing them and reseting permalink fixed this issue for me.
I am not sure about this but, Put your htaccess file back and
RewriteBase /
replace with this
RewriteBase /public_html/
and
RewriteRule . /index.php [L]
replace with this
RewriteRule . /public_html/index.php [L]
May be it's the problem of URL rewriting.
Add the below code in .htaccess file -
# 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
Once done then please make sure that the site URL and home URL for your site are set correctly. You can update the site URL and home URL from wp_options table, WordPress configuration file or from the WordPress administration panel.
Once done then please clear the cache of your system and try to access the website.
Let us know how you go.
Thanks to all of you for your valuable help and inputs. I struggled a lot on this issue and able to find the solution following these steps. Hope it will help some like me.
# Always use domain name in lower case.
In my case client domain is "SuzieSellsAZ.com" treat it as "suziesellsaz.com" all lower case.
Use Database Search and Replace Script in PHP to replace all occurence of previous domain.
ref:
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Update the siteurl and home URL in database options table and all other occurrence in the database.
Once it done or database update then you should import to any server and it will works fine.
Sometime site post or page URL does not work then go to setting > permalinks and save it. Site post and page URL will work fine.

Moved wordpress site, image links are all broken

Got an issue with a wordpress site that I've never experienced before. I have moved a site for a client from one server to another (I've done this several times before). The site has moved fine, however none of the images from my uploads folder are displaying. When I check the link, there is no "/" before wp-content, so my link reads like this:
http://www.vimartech.co.ukwp-content/uploads/2014/03/VIMARTECH-INDUSTRIAL.jpg
Here is my .htaccess file which is where I believe the issue lies. Can anyone help me out please.
# 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>
It's because wordpress holds full path to image in it's database.
This also true for configuration entries.
I haven't used wordpress for some time, but in the past I used a simple search/replace script to change old domain to new at doployment stage.

Wordpress blank wp-admin and some pages are not working with www

I have moved an Wordpress from one server to another. The address remained the same, so nothing is changed in the URL structure. The steps followed are as described in Codex page.
However when I try to access the admin page (www.mydomain.com/wp-admin) I get a blank page. Also, the same happens to some pages on my site - but not all of them. Some are working some are not.
In my .htaccess I have the usual:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^mysite.com$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Under wp-admin folder, .htaccess file is empty.
After a lot of testing, I find out that when I access http://mydomain.com/wp-admin (without www) is loading the login page, but after entering the username and password I get another blank page (it basically redirects to www.mydomain.com).
I believe this is not a .htaccess, but something inside Wordpress. I have the correct URL and HOME setup in wp_config (also because the domain did not changed after moving to a different server).
Strange thing is that some pages are working, some don't. What could be the reason?
I found that the reason for this is a blank space left on wp-config.php file, which made WP crash (not sure why other pages were working though...).

Resources