InMotion Hosting Support Center

htaccess change puts double slashses (//) in URL after creating subdomain for images

Category: Wordpress

standardtoaster
Asked:
2013-07-31 11:59 am EST

Hits: 7,887
Hello!

I recently read about the benefits of creating a subdomain to serve up images for WordPress blogs.

It would have been better to do this before making blog posts, but I followed the instructions in this article:

http://bit.ly/12FETaC


The problem is I'm now seeing double slashes when I'm looking at an image's direct URL path. Here's an example blog post:

http://bit.ly/17ipSHZ

The direct URL path for the pizza picture has two (//) slashes:

http://img.thatlovesong.com//2013/07/gourmet-cheat-pizza-1050x700.jpg


It doesn't appear that desktop Chrome browser minds the double slashes; it still loads and renders the images.

How do I eliminate the (//) slashes?

You must login before you can ask a follow up question.

You must login before you can submit an answer.

Best answer chosen by User

0

Arn
Staff
42,973 Points
2013-07-31 1:28 pm EST
Hello StandardToaster,

Sorry for the issues you're having with the path. There are a few possible causes to the problem. One possibility appears is your use of multisites in WordPress. According to the WordPress Codex, you would need to manually review your paths in the database: Multisite notes

If you are not using the WordPress installation as a multisite, then you may want to consider removing the option.

Another post hinted that it may be caused by a plugin (the plugin author acknowledged the problem). In either case you may want to double-check the paths in the database by looking at it manually. You can use phpMyAdmin to edit the database as necessary.

I did try disabling and re-enabling the permalinks to see if it would have an effect, but so far it's not affecting it. I also tried turning OFF the .htaccess rule that you have added. This gets rid of the double-slash, but also removes your custom re-written path.

The extra slash is coming from WordPress when it's generating the automatic path (based on the permalink) in combination with the .htaccess rule. Both are working the way they are supposed to be working. This is not a server caused issue, but something that appears to be part of how WordPress is generating the path. You may need to send a message to the guy who gave you the instructions for the rewrite. It is possible that the re-write rule needs to be adjusted.

During our testing, I did notice that you removed the graphic. So, I could not continue to troubleshoot the problem. If you do continue to have issues with it, please let us know. If you intend to have us continue to review the problem, could provide us an example of the issue (since you removed the existing one)?

Thanks for your patience!

Regards,
Arnel C.

You must login before you can post a comment about this answer.

Wow! Thanks for the detailed response, Arnel. That was a really fast response.

So I double-checked paths in the wp_options table and edited the value for "upload_url_path" from "http://img.thatlovesong.com/" to "http://img.thatlovesong.com".

I think this change fixed it.

I uploaded another picture to test and there are no double (//) slashes when looking at direct URL path.

Here's test picture: http://thatlovesong.com/?attachment_id=601

The image URL appears as: http://img.thatlovesong.com/2013/07/indoor-rock-climbing-2.jpg


Now, I say I *think* this fixed it because double slashes will appear for some existing posts' pictures.

For example, the album cover image's URL path in this recent post (http://bit.ly/15bVlzS) doesn't have the double slashes. Note that this post was published before I made changes to the table.

The image URL appears as: http://img.thatlovesong.com/2013/07/darcys-warring.jpg


However the image URL in this older post (http://bit.ly/1bKEqId) still has the double slashes.

The image URL appears as: http://img.thatlovesong.com//2013/07/jamiedave_wedding-258pink1-682x1024.jpg


Do you have any explanations around why a newer post isn't plaggued by the (//) while older posts are?

Again many thanks,
Dave
standardtoaster
38 Points
2013-07-31 2:05 pm EST
Hello Dave!

Thanks for your response! It's no problem. I was researching you question a bit before answering because it was very good question. I think I know the answer for your current question.

It's been my experience that the path is being stored in the database. So, the reason you're seeing it on the post was probably because it was generated at a time when the double-slashes were occurring, and the database captured the double-slash occurrence. Do a search through your database in the wp_posts table. You should see the paths stored in the GUID column.

Hope that helps! If you still need further assistance, please let us know.

Regards,
Arnel C.
Arn
42,973 Points
Staff
2013-07-31 2:30 pm EST
I wanted to confirm the "old post" problem was due to the path being stored in the database. I searched through the database, in the wp_posts table, edited the paths stored in the GUID column. And voila - problem fixed.

Thanks again for your help, Arnel.
standardtoaster
38 Points
2013-07-31 2:50 pm EST
Like this Question?

Forum Login

You are NOT logged in. You can still browse our Support Center.

To participate within our Community Support Forum:

Need more Help?

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!