Drupal relative link problems moving from mydomain.com/test to mydomain.com - drupal

I currentley have a test site up and running on mydomain.cm/test. I am using the WYSIWYG module with tinymce to allow my customers to upload pictures to the site. One a image is added to the site tinymce/imce does not use the base url defined for the site in front opf links but gives linkes realtive to the root i.e. a picture of img.jpg will be linked in the code as /test/img.jpg. When the site goes live and we lose the /test the img will no longer be found there.
What would be the best way to bulk upload all the links before going live to remove /test in front of the links?
In the future when settting up a test site I will user a subdmain instead so I will not have this issue.
Any help would be apreciated.

The easiest way is to run a MySQL query directly on your database. Just search and replace in your node_revisions table in both the body and teasers column.
update node_revisions set body = replace(body,'/test/','/');
update node_revisions set teaser = replace(teaser,'/test/','/');
Of course, backup before you do this.

One solution is to leave all your content untouched and rewrite all the /test/*.[jpg,gif,png] urls through a rewrite rule in .htaccess.

Related

How to remove a WordPress page from a path?

I have a site that was made in WordPress and I need to remake it just with HTML and php.
The problem is
I have a page at the url www.mydomain.com/create
I created a new file with same name, www.mydomain.com/create.php
Now on the host I removed the extension .php, but the problem is i will still hit the word press page.
Where can I find the file with the url set for this page? I don't know much about word press besides where plugins are.
WordPress does not use one file per page / post. WordPress instead has a template system inside themes that defines how pages and lists of posts are turned into HTML. The content of those pages and posts resides within the database and can be viewed in wp-admin. Further, WordPress extensions and themes can define hook functions and filters to modify content and style of the page and execute code upon certain events.
You cannot find a file for this "/create/" page. It has some content in the database but the content itself won't render into what you see in the browser.
Sorry to say this, but if you like to recreate the site, you will have to find a new way of constructing and rendering it (and also reusing code). You might also want to look for a proper framework like Laravel and have some proper routing in place (instead of renaming PHP files).
Edit:
You can change the permalink for create like so:
UPDATE PREFIX_posts SET post_name = 'create_old' WHERE post_name = 'create';
You have to adapt the MySQL table name to the WP posts table by replacing PREFIX with whatever prefix your WP posts table has.

Backend content of page is not showing in wordpress

Okay so my problem is that, I am currently working on a website which is already been created using wordpress. My problem is that when you see the website page, there is all the data and everything is present. But when I come to the backend of the page in wordpress its not showing any content at all. I mean its like there has never been the data at all in this page. Its so confusing. Please answer me this. And kindly remember that I am not a good coder so anything that is related to coding please ellaborate it with examples.
I 've fixed it.
The problem is in charset of db.
Open wp-config.php file and just change charset to utf8 & comment the old one.
define('DB_CHARSET', 'utf8');
Thanks
Like the other commenters mentioned, you can also insert content into pages on Wordpress with pages on custom themes.
Remember to back up your site before you make any changes.
Try to change your theme by going to 'Appearance->Themes' in the Wordpress admin window and activating a new theme. Head to the page in question and see if the content is still there. If it isn't, it's being added in a custom theme, which is probably what's happening.
If that's all you need to know, you're all set - otherwise, you can use this process to find what's creating the content:
Go to your Wordpress installation directory (you'll know you're there when you see folders like 'wp-admin' and 'wp-content'), then go to 'wp-content->themes' and see what themes you have installed. You can dig around in the php files there to find the content being created. You'll need to play around with PHP if you want to learn more from there.

Change wordpress post content url from mysql?

Where do I go in the Mysql database to change the path of the media that are already inside the post instead of having to each post one by one and change the links url.
This is a great plugin, I use it all the time
http://wordpress.org/extend/plugins/search-and-replace/
you just tell it what you want to change and it will go through your whole db find/replace. totally recommended.

WordPress Inside Pages Default to Index Always?

I set up a site with WordPress using the automatic setup through a hosting provider. I am in WordPress, and it's working well in that I can create pages. However, when I go to view the page, it always defaults to the index page. So for example:
If I go to www.site.com/about
It goes to www.site.com
It does not show the inside pages. I cannot figure out why it is doing this. Any thoughts? I have set up new WordPress sites before and have not run into this problem. Did I miss a step in the set up process?
Any help would be greatly appreciated, thank you.
Without putting my hands on your site it is difficult. Is is possible for you to share a link to your site?
What theme are you using? Are you are using a custom theme? If so check if you have a file in your theme folder that is called page.php and that is not the same as your index file.
Try clicking on the page preview button from inside the page editor. Check the url to be sure it is the one you are expecting.
Have you adjusted the permalinks in your WordPress configuration? Double check that it is valid. Should be something like */%post_id%/%postname%/*
I hope some of that helped. try to give a little more info about you settings.

Only allow users to view the site when using an Iframe inside another site

I created a wordpress blog, but need to allow the users to view the blog, only if they are accessing the site using an iframe that is on another site. Im treing to find out a solution for this, but couldnt come up with any ideas.
Any ideas ?
Thanks
Bruno
You could check the parent URL from the IFrame.
So mysite.com has an iframe called blog.somewhere.com
in blog.somewhere.com you check the parent frame URL and if it is not mysite.com you redirect the user somewhere else (probably to mysite.com frontpage)
Hope you can make it work
Add an extra query var to the query string, then check if it exists in your header.php file. If not, display an error telling the user how to view the site.

Resources