Repair links after updating my URL - mysql

I need to repair all the URLs in a Wordpress site. The problem is that the site domain was bought after the hosting plan. The hosting assigned a static IP and the site was mounted using that IP. Now I need to update over 700 links in the database from http://xxx.xxx.xx.xx/~blah/ to http://www.example.com. Is there an easy way to do it? I already checked and most of those links are in the guid column in the wp_posts table. I have access both to the wp-admin and phpmyadmin in c-panel so, any solution would be nice.

That known problem has a pretty easy bypass.
Just download that great tool right here https://launchpad.net/mysql-search-replace, put the extracted folder in you serverץ
Go in your browser to the mysql-replace.php file that inside the tool's folder.
Then, write your old ip address in the search field and your new domain in the replace field.
Fill in your hostname, database name, username and password, click on the replace button, and that's it! All the places that your IP is written in your DB will be replaced with the new domain!
I suggest to do a search before the replacing, to ensure that you'll replace the right query and not ruin your DB by mistake.

Related

Website Images dont get loaded, URL looks cryptic

So on a website Iam working on some images dont get loaded.
The console says: Failed to load resource: net::ERR_NAME_NOT_RESOLVED
and then a link like that:
http://s234127563.online.de/wp-content/uploads/2014/04/myimage.png
If I change the first part of the URL http://s234127563.online.de/ to the actual URL http://example.org/ the images get shown
Does anybody know what this problem is about? Maybe some DNS thing or something. I tried different browsers and to renew my ip address and flush dns etc. but nothing changed
Looks like a mismatch in your database. WordPress stores your base URL to generate permanent links etc.
Change the URL stored in WordPress. There’s a page dedicated to that on the WordPress Codex. Hardcoding the URL in wp-config is most reliable, but perhaps not most desired.
The URLs are saved in posts etc, so you may have to update those. The Velvet Blues Update URLs plugin can do this for you.
Manually update non-default fields (theme options, custom fields, etc)
If none of the above works... are you using a CDN of some sort?
Check your database. In the wp_options table there should be 2 rows, one called siteurl and the other one called home. Make sure both are set to be your domain name, so http://example.org/
Wordpress sets this URL at the start during installation, and if you for example had this URL set to something different before, in case of a migration to a different domain name or something else, it can differ from the domain name the website is currently being shown on.

How do I protect a directory within github-pages?

I am building my personal website using Jekyll and hosting it at github-pages. I would like to have a password protected area (just password protected directory, not the whole website). I have tried a few options and tricks to get htaccess to work but failed.
I would like to know if someone managed to use htaccess, or any other method, to protect a directory on github-pages.
Listing solutions which did not work for me (or I failed to get them to work):
*Flohei.
*Jeremy Ricketts.
GitHubPages (like Bitbucket Pages and GitLab Pages) only serve static pages, so the only solution is something client side (Javascript).
A solution could be, instead of using real authentication, just to share only a secret (password) with all the authorized persons and implement one of the following scheme:
put all the private files in a (not listed) subdirectory and name that with the hash of the chosen password. The index page asks you (with Javascript) for the password and build the correct start link calculating the hash.
See for example: https://github.com/matteobrusa/Password-protection-for-static-pages
PRO:
Very simple approach protecting a whole subdirectory tree
CONS:
possible attack: sniffing the following requests to obtain the name of the subdirectory
the admins on the hosting site have access to the full contents
crypt the page with password and decrypt on the fly with javascript
see for example: https://github.com/robinmoisson/staticrypt
PRO: no plaintext page code around (decrypting happens on the client side)
CONS:
just a single page, and need to reinsert the password on every refresh
an admin could change your Javascript code to obtain the password when you insert it
One option is to use Cloudflare Access to control access at the DNS level.
After setting up a custom domain for your Git pages using Cloudflare for DNS, you can use their Access rules policy to require authentication at the specified url path.
This could still be bypassed if someone is familiar with bypassing DNS blocks.
https://www.cloudflare.com/products/cloudflare-access/
You can give a try to Jekyll Auth and if you run into troubles, this issue can be useful.
You can use Render to deploy your static Web app. It has a npm package that encrypted your html files and user can not see it in browser. So you can use frontend password validation.

URL of Category page in Magento changed to /shop-3.html how to change it back to /shop.html

After I changed the URL key in Category management in Magento from "shop" to "webshop"and later changed it back to "shop", the url of the category page now shows up like /shop-3.html Is there a way to go back to the original /shop.html?
FOUND THE SOLUTION: http://www.youtube.com/watch?feature=player_embedded&v=8xttr_ILd6A
Sometimes when you make changes to your products, or enable a certain extension, Magento might start to rewrite all your URLs to include a suffix "-1" or some other number. Within the URL Rewrites, Magento differentiates between System URLs and Custom URLs. If the System URLs are broken like this, you should not fix this by adding new Custom URLs.
Instead, open up phpMyAdmin, create a backup of your Magento database, and flush the Magento table core_url_rewrite (so that it becomes totally empty). Immediately afterwards, refresh the Catalog Url Rewrites under Index Management. This will regenerate all System URLs.
you can edit url write,i think there will be entry like /shop-3.html just change it is you want
http://www.magentocommerce.com/wiki/modules_reference/english/mage_adminhtml/urlrewrite/index
and also refer
http://www.magentocommerce.com/knowledge-base/entry/what-url-rewrites-are-and-why-they-are-important
hope this will sure help you.
Simple answer
just delete url related to shop (custom and system generated), than run re-indexing it will work

prestashop move to new server drops back to localhost

When I try to move my site prestashop site to new server and when I trying to enter it, it drops me to localhost. What else needs to be done? I did these steps:
Upload all files to new hosting via FTP
Import the database using the phpMyAdmin utility
On database we need to open ps_configuration table and edit the following lines: PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL and we replace the current domain www.olddomain.com, with the new one www.newdomain.com
For last we have to edit the settings.inc.php file inside the config folder and change the values for database name _DB_NAME_, user _DB_USER_ and password: _DB_PASSWD_
That’s it, you only need to check .htaccess file permissions (777) and all should work correctly!
But it does not work correctly :|
You also need to change the ps_shop url, the value of the domain by www.yournewdomain.com
and change too the domain ssl by your new domaine www.yournewdomain.com.
If you put your site in a subdomain then write the physical uri too
www.yournewdomain.com/name-of-your-suddomain-prestashop.
It will work perfectly!
Login to your PrestaShop admin panel on domain you are moving from (olddomain.com)
Navigate to Preferences -> Maintenance and put your shop in maintenance mode to avoid loosing new customers or orders while moving the data.
Navigate to Preferences -> SEO & URLs and scroll down to Set shop URL section.
There please change Shop domain and SSL domain to your new domain (newdomain.com).
Update Base URI if it is different on your new domain.
Download all PrestaShop files and folders to your computer.
Login to your phpMyAdmin and create a backup/dump of the database you are using for your PrestaShop.
Create database on your new domain (newdomain.com) and import database backup/dump from your (olddomain.com)
Edit /config/settings.inc.php file which you have downloaded to your computer.
There you should update the settings for the new database server (with your own settings instead of the examples here):
define('_DB_SERVER_', 'your.sqlhost.name.com');
define('_DB_NAME_', 'database_name');
define('_DB_USER_', 'database_user');
define('_DB_PASSWD_', 'database_pswd');
Upload all the PrestaShop files and folders to your new domain (newdomain.com) via FTP.
Remove all the files except index.php in /cache/smarty/compile and /cache/smarty/cache folders on your new domain (newdomain.com)
Login to your PrestaShop admin panel on new domain (newdomain.com) and check if it is working properly.
In your PrestaShop admin panel navigate to Preferences -> Maintenance and put your site online.
Check that all the links are functioning, that all your products, images, modules and themes are still there, and try to create a new account and place an order to make sure your shop is working as expected.
I had the same issue a few days ago and just spent 2 minutes trying to remember...
Anyway, if you're using 1.5, you also need to change the url in the shop_url table. Hope this helps!

Wordpress - ftp'd site/exported database to localhost, localhost images still point to .com, why?

I FTP'd over the entire wordpress site and exported the Database and got it running on my localhost throught WAMP, but for some reason the links and folder are still pointing towards it's .com, and a 404 error comes up as well.
I suspect it has something to do with .htaccess but I'm not sure.. Can someone steer me in the right direction?
Did you update WordPress Address (URL) and Site Address (URL) under General > Settings?
They might still point to old domain.
Transferring the site over FTP to your local machine is the same as "moving" it to a new domain. Wordpress provides specific instructions for such a move which you can find #
http://codex.wordpress.org/Moving_WordPress
When Your Domain Name or URLs Change
When your domain name or URLs change - i.e. from http://example.com/blog to http://example.com, or http://example.com to http://newexample.com - there are additional concerns. The files and database can be moved, however references to the old domain name or location will remain in the database, and that can cause issues with links or theme display.
If you do a search and replace on your entire database to change the URLs, you can cause issues with data serialization, due to the fact that some themes and widgets store values with the length of your URL marked. When this changes, things break. To avoid that serialization issue, you have two options:
Only perform a search and replace on the wp_posts table.
Use the Search and Replace for WordPress Databases Script to safely change all instances. ( If you are a developer, use this option. It is a one step process as opposed to the 15-step procedure below )