How to hide a directory within URL call - wordpress

I don't think what I want can be done, but I thought I'd try here .. maybe someone can think outside the square for me...
I have installed wordpress on my domain at /wordpress.
I will eventually move it to / when it is finished and overwrite the existing content.
My problem is that in my posts, I have to reference images directly (i.e. /wordpress/wp-content/uploads/image.png)
My problem is that when I move wordpress to root, all of those images in the posts are going to be rendered invalid.
What I want to do is try and make a request for /wp-content/uploads/image.png find /wordpress/wp-content/uploads/image.png but I can't redirect everything to /wordpress because my existing site will disappear...
I'm thinking I need to install some type of internal media manager because I just can't see how this could work

this might help u
RewriteRule ([^.]+\.(jpe?g|gif|bmp|png))$ http://www.newurl.com/$1 [R=3-1,L,NC)
u can get image name from old url and pass to new url..

Redirecting is not really a solution here, IMO it just creates additional load, you should do a database wide search and replace of all referenced URLs after you move.
I recommend using searchreplacedb2 - I've been using it for years and it works great for me-
http://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Search yourdomain.com/wordpress
Replace yourdomain.com

Related

How do I point a vanity URL to my homepage without the URL changing in the browser?

I'm trying to make a vanity URL, say example.com/saveWD, take someone to the homepage, example.com, but not actually redirect it - so they see example.com but the URL in their browser reads example.com/saveWD. Right now I have this in my htaccess file:
RewriteEngine On
RewriteRule ^saveWD index.php
Is the best way to go about creating this? If so, what am I doing wrong?
Thank you!!
I wonder why you'd need to do something like this, but I've had to do much crazier things haha.
You can absolutely use .htaccess rules, which if you only need a few vanity URLs will be absolutely sufficient, or set up domain masking (which would probably be way over-complicated for this).
Shameless plug, I've also written a plugin that may work for what you need called Content Mask. You make a page/post and put a URL in the Content Mask URL field, and it will replace the content of that page/post with the content from the URL.
I wrote it because we needed to embed external landing pages and reputation software, such as example-client.reputationsoftware.com or landingpagemaker.com/example-client/landing-page-1 onto https://example.com/reviews or https://example.com/landing-page.
I made a test using my plugin's homepage https://xhynk.com/content-mask/ and masking it on https://xhynk.com/content-mask/saveWD
You're more than welcome to give it a shot if you want, here's the source code of the current version so you can see nothing funky is going on: http://plugins.svn.wordpress.org/content-mask/tags/1.2.0.2/content-mask.php

Remove auto added "http://" in wordpress user website

When I add a website (url) to a user in wordpress, it automatically gets "http://" added to the start of the url. Is there a way to stop this happening? It is causing other plugins to not function properly as I call on the user_url but need the http to not be present?
edit: i have tried editing user-edit.php to change the "Website:" field input type to text instead of url, but no avail.
Thanks, Nick
What plugins are causing issues with that? It usually works perfect and must not have any issues as per my opinion.
but there is one trick that MIGHT work in this scenario : using Protocol relative URLs
So instead of putting user website as "www.yahoo.com", try putting "//www.yahoo.com" and see if it works for you.

Wordpress Migration issue css

I have migrated website to new domain, the problem is css not loading
if I inspect element it gives link to old domain, is there a way to update css links in wordpress?
please help
When moving a WordPress site to a new domain, you need to change the Site URL and Home URL, usually in the database or in wp-config.php, depending on how the site was originally set up. There may be other changes you need to make in the database, or by manually editing posts, like the locations of images in posts.
This page on wordpress.org is a good reference, for all the things you may need to change, and it shows a few different methods to make most of the changes, so you can choose the one you prefer:
https://codex.wordpress.org/Changing_The_Site_URL
Make sure to keep a backup of the site in case of any mistakes. If you make some changes, and most of the site is working, but a few things aren't, I would recommend making another backup, so you could restore it again without losing much work, if needed.
yes when you are adding links to your site you show use the function site_url().example/my_post in order to construct the links

Broken WP images after domain move

I have just moved a site from the domain trfinch.com to moralesfinch.com and all the images seem to be broken. I know this is a common issue, but my problem seems particuylarly complex.
After the move, I used the 'Better Search Replace' plugin to replace all absolute links in the database. I am seeing the broken img icon in all instances, wether in the Media Library or the Front end.
However, here's the interesting bit, if I inspect the image code and manually visit the URL, the images are all there. Something is stopping them pulling through to the main site.
The issue also seems to apply to background images and favicons too.
Any suggestions?
The image urls look right, it is most likely not a problem with wrong siteurl and homeurl as codenathan pointed out, but it is still a good idea to check. My instinct would say it is a problem with routing/permalinks. Try updateing the permalink structrue, or even try deactivating pretty permalinks and see if it helps.
I observed that your website forwards you to the main page (not the 404 page) when you put in the image url directly into the address bar. Do you have access to your server logs? Try locking at Apache's access.log to find out what happens to the .jpg requests.
My last guess would be a permission issue with the uploads folder, but there is no way to know without log files.
Hope it helps.
you may want to open the database and look at the table called wp_options
and look at column labelled option_name and look for the records for : -
siteurl and homeurl, and if these records still reference the old site replace them with the new site domain.

Change URL NextGEN Gallery Plugin

We are using the NextGen Gallery plugin to generate a slideshow in a Wordpress site. I needed to change the site URL to a a different subdomain, and this seems to have broken the links. The plugin-generated javascript still passes the old URL to swfobject.embedSWF.
Does anyone know how to fix this? I already updated the Wordpress "General Settings" with the new WordPress address and Site address (which are the same), and the plugin does not seem to pick up that change. Thanks!
Found it. It's in the string-encoded ngg_options entry in the wp_options table. The specific field is "irURL".
Why they chose to capture the site URL independently, instead of reading it from the Wordpress site configuration, is beyond me.
Could it be that NextGen has hardcoded those values somewhere in its database tables?
It could be a matter of running a bunch of SQL update queries to replace any instances of http://old.domain for http://new.domain
And now I'll state the obvious, recommending you to backup the full DB before you attempt any of this.
I had the same problem (unchanged absolute CSS/JS files' paths) after domain changing although I changed every single old domain's occurrence in database (even in serialized arrays/objects in options).
I found solution on http://www.nextgen-gallery.com/galleries-opening-lightbox/ - I didn't have time to do an investigation where they store these paths or in which format. :P
For me it is extremely stupid in Wordpress that it stores absolute paths (with one and the same domain) in so many places but that's another matter. :)

Resources