Change site URL should alter the table or create .htaccess? - wordpress

I don't know where else to post serverfault, superuser or here, but Please accept my apology.
I got a very big tast I would say because I never done this before myself.
There is a site which they are running on Wordpress for over a year and they just bought a new domain name.
So they asked me they want to just change the domain name of the http://oldsite.com to the http://newsite.com what happen to myself before when I have the same situation I just move from one server to another server and changed the domain name at the same time with wordpress they store the URL of the images like absolute url not like relative so sure that many images will not be display.
So in his case that they are still going to use the same server which means all the picture will still be in the same folder /wp-content/uploads/*
So my question is how can I change his domain name without affecting the pictures in his site after changed the domain?
Doing alter table? or .htaccess mod rewrite?
if there is any better option please suggest me I would be so much apprecaited :)
Thanks and again please accept my apology for not knowing where to post.
UPDATE
The only and most important thing is that how to make all the pictures from all the posts still appear after change the domain.

Try putting this in the htaccess file in the document root of the oldsite.com domain:
Redirect 301 / http://newsite.com/

Related

How to remove indexed URLs from Subdomain without Encountering 404 errors in Google

I have a domain (ex. test.com) on which wordpress is installed. I also have a another wordpress installed on a subdomain(ex. test.com/blabla). Blabla contains many indexed pages but now I want to remove them completely and delete the wordpress on the blabla subdomain.
How can I achieve that? Keep in mind that I don't want anything to change in test.com
I would really appreciate your help,
Thank you in advance.
The .htaccess file can help you to achieve that. Please invest some time to dive into that.
You have to use the
Redirect 301
for your subdomain to redirect to the new page or any other page if you want to.
Make sure, that your robots.txt allows Google to access the old page directory.
When Google is able to track that the old page has been removed, it will no longer appear as search result.
Then you no longer need to rediect.

park a domain without redirecting in wordpress

i have a wordpress website with this name mydomain.ir
i parked mydomain.com to this website. but when i type mydomain.com it redirect to mydomain.ir
i want to address stay on mydomain.com .
i try some plugins but didnt work properly.
my host service told that this is a worpress error and you should change your codes.
i tried this but didnt work too
what can i do to do this?
thanks for your answers
First of all, make sure that you have the correct url at wordpress settings. Check Settings->General and make sure that site and home urls ar the one you want.
Next, check if there is any kind of redirection at .htaccess file.
Then, check at your cpanel if you have added any redirection there.
Finally, make a search at your wordpress database for your unwanted domain name. Make sure to change all old urls to the new one. Try this plugin for that: https://wordpress.org/plugins/velvet-blues-update-urls/
Update:
Alternatively, you may want to mask your domain. This should be done through your domain name registrar.

How to get sub-domain of Wordpress in url structure

I have created a Wordpress install on a sub-domain of my server. So for example my url is www.myUrl.com and I created a subdomain that is essentially www.myUrl.com/sub. I installed Wordpress on www.myUrl.com/sub and it works fine.
The site shows up on that new url as it should BUT when I click a link, lets say 'blog', instead of taking me to www.myUrl.com/sub/blog it takes me to www.myUrl.com/blog.
I am pretty new to wordpress and have looked up the issue but can't find any answers. I have messed with the absolute path stuff inside the .wp-config file but cant' figure out what to do and if this is indeed the file I need to change. I have also tried to find this on the permalinks page.
Please let me know what other information you need to help me answer this question and thanks in advance.
It looks like your home URL is defined as "www.myUrl.com" in the database. U can find this in the wp-options table in the database or in WordPress at the general settings. When I move to a subdomain I also delete the .htaccess and save the permalinks page of the settings so the .htaccess gets a refresh.

wordpress permalinks with prefix for wildcard

I'm having trouble trying to program into Wordpress a wildcard for the permalink structure. So for example, I'm trying to setup a permalink where the link is like this: foo.example.com/company. At the moment, the wildcard is in place for the URL (foo.example.com), but the permalinks are still under the root (example.com/company). Is there a way to program it so that the permalink will be matched exactly to the URL that is written. So if I entered in dsdd.example.com, the permalinks will display dsdd.example.com/company, etcc...
This kind of thing is way over my head, so if someone could provide some code examples of how to accomplish this, it would be much appreciated. Thank you.
I'm not sure what your current setup is, but I can offer advice based on my prior experience with web hosts and WordPress.
If you want to have something where the subdomain (something.example.com) is a wildcard (thiscouldbeanything.example.com) and still point to your WordPress installation, you're going to have to get your host to set up something called a Wildcard DNS Record
From your description, you might have this set up already. If so, cool.
Using the wildcard is another story. Personally, I would go with a .htaccess file, and use mod_rewrite in order to have it use the wildcard subdomain to be used in the URL.
WordPress MU (Multi User) uses something along these lines to help you set up a subdomain network, and you can probably use their .htaccess file demonstrated here
Without REALLY specific information about your setup and goals, I couldn't be as much help as I wanted to be, but good luck!

Changing the URL of a wordpress site

I have a wordpress site at http://myname.myprovider.info and I just bought the domain http://www.myname.com
Ive tried to change the URL in the backend at "Setting > General" both fields WordPress Address (URL) and Site Address (URL) with http://www.myname.com. The moment i click save, Im automatically logged out of the backend. If i try to log back in, I get a white screen.
The only way to log back in is to add in the config file the following line:
define('RELOCATE',true);
If then I go back to "Settting > General" I see that WordPress Address (URL) still has the http://myname.myprovider.com and everytime I try to change it again, the loop starts again...
What can I do?
you cant just change the url in wordpress ... you would need to move all the files to your new host
you can facilitate this in wp-admin
under tools select export and follow the dirrections
then setup wordpress on your new host
and goto wp-admin and select tools import and select the earlier exported file
If you're moving from a subdomain to the main domain, you have to move files. See Moving WordPress « WordPress Codex and How to Move WordPress Blog to New Domain or Location » My Digital Life and check with your host; the URL structure "myprovider.info" may be problematic, whoever the "provider" really is.
I had a very similar problem some time back and I'm trying to remember what the source of the problem was. Until I do, here are some ideas you may or may not have tried:
(obviously backup everything first!)
Check your code (theme, scripts, functions.php, etc.) for any instances of the old URL. Sure, we all know better than hard-coding the URL but...
Do a search through your WordPress database for the old URL. Carefully (very carefully!) replace it with the new one. In my experience some plugins aren't well behaved when it comes to storing the web site URL in the database.
Try disabling all plugins to see if one of them is causing a problem.
I assume you've set the DNS by hand, rather than your domain registrar putting in place some kind of forwarding?
After much tinkering, it turns out I didnt configure the domain properly :P Thanks for all the help anyway.

Resources