Resolving urls on a Wordpress server using React - php

I'm working on creating a new React-based site to replace an old WordPress site. I have been creating directories within the wordpress server for the new sections I have been making. domain.org/about, for example, will go to the react files stored in the about directory. No problems there. The issue I am having now is for more complicated urls. I have set up react-router to handle lots of events by using an id to pull in information on a specific event. domain.org/events/event123, for example, should display information on event123. In development this works fine, localhost:3000/events/event123 will display event123. On the wordpress server, however, I get an error. I realize that this is because there is no event123 directory within the events directory on the wordpress server.
How can I configure wordpress to handle these urls? I realize I need to set something up so that any url that begins with domain.org/events will go to the react files in the events directory, but how I go about doing this while still passing along the event123 I do not know. Any help is appreciated. Apologies if my description is a bit confusing.
EDIT: I should add that the old parts of the site and new parts of the site have no connection to each other, other than the fact that they are hosted on the same server. Once the new site has enough content on it it will be moved to a new server and the wordpress site will be shut down.

Related

Redirect wordpress website to another site

I moved my wordpress website with updraftpluse backup plugin to another domain and now when I open new domain website redircet to Previous domain.
what can I do for fix this problem?
please help m!
Migration to a new domain is a different task from restoring a backup. Doing it correctly requires updating hyperlinks embedded in your site's content, as well as loading the site data onto the new server. It's quite difficult to update all the hyperlinks manually. But if you don't you get the results you mentioned in your question.
Updraft's paid version supports migration and automates the hyperlink update operations. So does Duplicator's free version.

How do I change a wordpress dev site url that was overwritten by live site backup

We have a dev site www.dev.site.co.za & a live site www.site.co.za.
I wanted the dev site updated to be a current replica of the live site, so our hosting provider copied it over.
But now when if you go to www.dev.site.co.za, you are "redirected" to www.site.co.za. I have tried changing the siteurl in phpmyadmin but that hasn't resolved the issue.
Is there somewhere else the url needs to corrected and is there anything else I need to do to make sure the dev site is a completely separate environment to the live site so I can safely fiddle without damaging the live site?
wordpress not only uses the database in PHPMyAdmin for the url.
As mentioned in the official documentation there are several files that can include the url:
the wp-config.php (wordpress file)
the functions.php (theme file)
Check these and have a look for the url address.
Have a look at the .htaccess file!
Also:
Helpful for that issue (e.g. restoring a wordpress page on another server) is the plugin BackupBuddy. It is one of the most well known plugins for wordpress. (Know right now that it is a paid version! But as always there are others with the functionality).
It allows you to backup and restore your page on a new system. You can initially set your new desired address for the system then.
Maybe it is worth a look!
For rectifying your dev site issue, you can try this.
Following is the URL to a simple utility via which you can replace some value in your database with some desired value.
https://github.com/interconnectit/Search-Replace-DB
Download the utility (zip file).
Upload it to your dev site root location and unzip it there. So that the the URL of the unzipped folder becomes: www.dev.site.co.za/Search-Replace-DB-master/.
Visiting that URL will show you the screen with options to replace some values in your database with desired values.
This utility automatically selected the connected database.
Put the URL of your live site in the field to replace.
Put the URL of your dev site in the field to replace with.
Choose the Dry Run option to see what all tables and columns will be affected.
Once you see the results and know what is changing then you the click on Live Run.
Clicking on Live Run will change all the URL of your live site in dev site database with URL of your dev site.
Once the changes are done you can delete this folder.
Hope this will at least resolve the problem of redirection of dev site to live site.
Once the new site is built you can then migrate(move, copy) it to the live site's location. There are some tools out there to help with moving the site you can use once the site is done. Some require a plugin to be installed to do that though. For example magicmigration can be used to move the completed site to a new location (that one specifically doesn't take extra installs). It is also possible to manually migrate the site though depending on the situation and know-how that can be a bit much for some people.

Installing wordpress in a different directory than root because another CMS is installed there

I have a weird situation with a client:
The root directory has a custom built CMS serving the site.
They want to rebuild the site in stages as it is very big.
So they want the new site in Wordpress and for the first stage just to build specific pages in Wordpress.
So obviously I would install WP in a sub directory or a different directory than root.
BUT, they want the pages served by WP to not indicate a different URL path so if we create a page called page1 the URL needs to be:
http://domainname.com/page1 not
http://domainname.com/wp/page1
Obviously if a browser navigates to:
http://domainname.com/page1
the CMS installed in root will try to serve the page and return a 404.
So my thinking is it must be possible to add a bunch of rules in the root folder htaccess (or with PHP) that check a list if the incoming request is for a URL we indicated in the list is meant to be served from WP, then to pull the files from the WP sub directory (bypassing the CMS installed in root) and rewrite the URL to root.
So if I go with my browser to:
http://domainname.com/page1
I will get the WP page
and if I go with the browser to:
http://domainname.com/wp/page1
it will server that page but with a 301 redirect to:
http://domainname.com/page1
Makes sense? Anyone know if this is possible?
I have tried but my htaccess/apache skills are not high enough to solve this one.
Thanks
You are in a very complicated position, in one way that could be very easy if your client doesn't bother with the subfolder which is pretty reasonable and cheaper because you don't have to spend time trying figure out how to get a clean URL, instead of that you can have a semantic URL like:
http://domainname.com/page/page1
So you have your Wordpress installation in the "page" folder and everything looks transparent for the user.
On the other hand, if you what create re-directions for each page you create in the new Wordpress you can do it in the Cpanel if you have access to the server.
The problem is you have to do after a new page publication.
In terms of SEO, you are getting a Soft bounce, which is not terrible but not terrific.
when you migrate all the content to Wordpress you have to delete all those redirections and will be more work to do in terms of SEO
The bottom line is if you have enough arguments for why you client could let you do it in the easy way that can help you a lot and save a lot of time.

Working with staging and Live url wordpress

I made my wordpress site live by moving it from the staging url (staging.example.com) to the live url(www.example.com).
I wont be working on the site anymore so I have to advice my client on how to manage things on his own from now on.
I have 2 options:
Let the client add blog posts directly on the live. When it comes to installing plugins or
any other changes that might cause the site to break, I can ask him to clone the live site by
using plugins such as wp-staging, test the changes on staging url and if everything works as
expected, then make the same changes in live.
I can ask him to make all the changes (adding posts, plugins etc.) on the staging url first and then transfer the
files to the live url. But how would we transfer the db from stage to live without overwriting the live db?
Also I used this script
to change the url in db but I dont want to let my client use that script because being a non-technical person,
I am afraid that he might end up deleting the entire files on the server or that he might forget to
delete the script after using it.
Or is there a better option? I am new to wordpress. Any help would be greatly appreciated. Thanks.
You could use a backup plugin like backupwordpress or any of the other popular options out there to backup the database and files on a regular basis. Then run the backup right before making any plugin/theme updates.
Well usually staging urls are used when developing plugins or themes. In your case you are simply installing new plugins and adding posts to the WordPress. This is how WordPress is normally used and it does not require a development site.
If your client installs well known WordPress plugins which are well tested, then he should not have any problems with installing them.

New to Wordpress and my new web host has it by default so I am stuck

I recently obtained a domain and website through bluehost. They have Wordpress installed and I am unable to figure out how to bypass it so I can code old school. I would really rather learn Wordpress but don't know where to start.
So two questions:
1.
what wordpress files are blocking me from the site recognizing the usual Default page's code? (I create test html in Default which is bypassed somehow and will only show Wordpress default page in progress; my code is not overwritten; just ignored?)
2.
I'd be happy to learn myself, but don't know a good resource. Went to Wordpress site and they have free webpage I can play with. Should I just get the free one in order to learn whats what...or is that going to be dumbed down and different than having it installed in webhost site?
I am a fairly advanced programmer and feel that I should be able to pick this up rather quickly if I can only get past this first hurdle.
Thank you for any information or suggestions.
What loads by default at a domain (ex: www.yoursite.com) is controlled by the web server which uses a configurable list of filenames like index.html, index.php, Default.aspx etc. You can learn more about how that works here.
Normally, your web host will allow you to have some control over that list, and the precedence one file takes over another when the web server refers to the list. Perhaps you have an administrative interface or dashboard control which allows you to configure this for your site. If not, you'll have to contact support at your web host to have changes made to that list.
1) Nothing is blocking you from seeing a page on your web server at a specific address, only from allowing one page or another to be what loads by default at the root web address, as explained above. If you have FTP access to your website directory, and can upload a file there, you can still browse directly to it, even though the WordPress installation's default page is showing up at your root web address. Just enter the specific file name in your browser, and you will browse to that page, ex: www.mysite.com/somepageicreated.html
2) Learning is always good either way, but you either want to learn to make WordPress sites or you want to learn to make your own websites. I'll assume WordPress for now, since you mentioned a preference for that platform. Just remember though: working with WordPress sites is not making your own website, it is changing a WordPress template to be as close as possible to what you want your website to be. This may or may not suit your requirements.
Playing with a free example from WordPress can be very useful for picking up the basics. Once you've played there for awhile and feel a bit more aware of how things work, take what you've learned and apply it to shaping your own site into what you'd like. Just remember to always create a backup of anything you mess with, so you can always return to an earlier state if you really mess things up good :)
Good luck!

Categories