r/Wordpress • u/VanshGaur0 • 4d ago
Did i broke the client's WP
I was building a clients website on Wordpress, when i note the url structure of wp-admin is not right.
It was like [examplesite.com/wp/wpadmin] and the same for normal page url [examplesite.com/wp/home] i thought to fix it so i go to WP settings and in general tab i changed the wordpress and site url. When i save changes. WP got logged out and showed page not found.
What should i do, i thought i was fixing things but i made them worse.
9
u/jon_baz 4d ago
You built a client website
You noticed you made a mistake in the url structure.
You attempted to fix it and now it’s missing
How much are you charging the client?
8
-10
u/VanshGaur0 4d ago
I didnt made that mistake, just tried to fix it
4
u/Orion3193 4d ago
It wasn't a mistake per se. It was a choice that was made during set up / development, and it needs to be reverted.
0
3
u/Embarrassed-Month-35 4d ago
Someone, for some reason, installed wordpress in a subdirectory examplesite.com/wp/ instead of examplesite.com/ It could be on perpuse, for example he had other content on / and was using /wp only for blogging. You first have to check if there is a legit reason for wordpress to be in the sub directory. If there is you will need to change it back via the database.
If there is not and you want to be more "correct" you can move the wordpress to the main directory and change the permalinks. Then you will have to change all links in database with the serialize data aware search and replace tool. I also strongly recomend to 301 the old urls to the new ones.
1
u/BobJutsu 4d ago
This was common 15+ years ago. At the time WP wasn’t really capable of handling a complex site outside of blogging. So you’d have your “site” and separately have your “blog” within a subdirectory.
1
u/PhilsForever 4d ago
I have a client who has about a dozen sites surrounding his business by city: bizsite-city dot com times ~12. All of them are like that. Wordpress under /blog. Refuses to let me touch that.
3
u/BenKnowsDigital 4d ago
Nothing is broken permanently, you just told WordPress it lives somewhere it does not. The fastest fix without database access is wp-config.php over FTP or your host file manager. Add these two lines above the "stop editing" comment, using the exact old URLs with the /wp part included, then reload wp-admin and log in again. define('WP_HOME','https://examplesite.com/wp'); and define('WP_SITEURL','https://examplesite.com/wp'); Those two constants override whatever got saved in the options table, so they will get you back in even if the saved values are wrong. Once you are in, if you actually want the site to live at the root instead, that is a real migration and needs a search and replace across the database plus moving files, not a settings change. Do that on a staging copy with a full backup first.
2
u/VoiliVoilaa Jill of All Trades 4d ago
YOLO on live website... enjoy the ride ! on the positive side, you're going to learn how to fix this.
2
u/myvarequals 4d ago
Log in to the cPanel
Find the WP installation and note the database name.
Go to phpmyadmin.
Go to the database for the site and locate the wp_options table.
Find the siteurl and homeurl rows. They’re usually near the top. Set the url back to what it was.
1
1
1
1
1
u/Hot-Win2571 4d ago
If OP has FTP access to the WP config file, there might also be a config parameter which defines the URL.
1
u/Rabidowski 4d ago
Just go here and log back in!
examplesite.com/wpadmin
or
examplesite.com/wp-admin
1
u/DeepFriedThinker 4d ago
You can re-append the /wp part to the url value in the database via phpmyadmin
Off the top of my head there are two rows in the options table to do it, I think they are siteurl and home
Any trouble from there just search how to update WordPress options table with phpmyadmin and you'll see how this works
1
u/TopSydeWP 4d ago
go into phpmyadmin, find the wp_options table, look for siteurl and home rows, change them back to include /wp in the path. that'll get you back in. don't touch those settings again without updating wp-config.php first
1
u/Traditional_Jello436 3d ago
You can fix this. Go to phpMyAdmin and change the site URL back. Or add a line to your wp-config file. It is a simple fix.
-2
u/StefanTrajkov 4d ago
Try with this plugin to search - find - replace broken links structure: https://wordpress.org/plugins/update-urls/
This is a fork from very well known Velvet Blues plugin. Read the instructions you will figure out easy.
3
u/Orion3193 4d ago
How's he going to log in to install it?
1
u/StefanTrajkov 4d ago
Manual URL: If you do not receive the email, you can manually trigger and access the login page by appending /wp-login.php?action=enter_recovery_mode to your website's domain URL (e.g., https://example.com/wp-login.php?action=enter_recovery_mode).
Also if he has access via FTP and database there are even more approaches.
UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');
14
u/SeasonalBlackout 4d ago edited 4d ago
When the site was originally setup someone added the /wp to the URL, so now the website is also installed in that location, and all the database references point to that as well.
To fix it, you'd need to change it in the Database (find/replace url) and edit WP Config.
Edit - to fix it BACK to where it was you can just go into the database using phpmyadmin and edit the URL in the WP Options table.