• Resolved psychedeliczen

    (@psychedeliczen)


    Hello:

    I installed this plugin to help with a problem that I cannot seem to fix. I have an art gallery online, and I use the Image Attachment Pages to display the individual images. (I use this instead of a lightbox for multiple reasons).

    My problem is this:
    The image attachment pages display the URL in the format of: ?attachment_id=
    What I want to do is change that to the image title, so instead of this: https://www.psychedeliczen.com/?attachment_id=1635
    The URL will be this:
    https://www.psychedeliczen.com/celtic-fairy

    I was unable to use rewrites to get it to do what I wanted. So I installed your plugin hoping it would help.
    When I change the URL using the Redirect section, however, all I get is a 404 Not Found when using the new URL.
    For the Source URL I put the original URL: https://www.psychedeliczen.com/?attachment_id=1635 and for the Target URL I put what I want it changed to: https://www.psychedeliczen.com/celtic-fairy
    Sure enough, it does redirect to the new URL, but it gives me a 404 error.

    Please help! Am I doing something wrong?

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author John Godley

    (@johnny5)

    When I change the URL using the Redirect section

    What do you mean by this?

    For the Source URL I put the original URL: https://www.psychedeliczen.com/?attachment_id=1635 and for the Target URL I put what I want it changed to: https://www.psychedeliczen.com/celtic-fairy

    Yep. Redirection only redirects from one URL to another. The target URL will need to be a valid page otherwise it will 404.

    Thread Starter psychedeliczen

    (@psychedeliczen)

    To answer your first question, I meant the Redirect section of your plugin.

    OK so if redirection only works for existing URL’s, then how do I go about what I want to do? Basically, I want to rewrite the Image Attachment pages so that the “?attachment_id=” part redirects to the image title in the URL (such as in the example above). I have tried using htaccess rewrite rules and they do not work. I have tried adding a piece of code (found in another WP forum) into my fuctions.php and that did not work either. I am at a loss as to how to fix this problem. Your help wouldbe greatly appreciated.

    Plugin Author John Godley

    (@johnny5)

    Redirection works on any URL, existing or not. It is up to you to ensure that the target URL is valid.

    In your example, you want the target to be https://www.psychedeliczen.com/celtic-fairy. This isn’t a valid URL and so you get a 404.

    If I understand your intent correctly then changing rewrite rules (via Redirection or .htaccess) is not the way to go. You will need to change WordPress to accept these attachment permalinks – adding rewrite rules doesn’t mean that WordPress understands what to do with the URL.

    Plugin Author John Godley

    (@johnny5)

    I forgot to add that I don’t know how to change WordPress to understand attachment permalinks.

    Thread Starter psychedeliczen

    (@psychedeliczen)

    Thank you for your help. I figured out the problem was using FooGallery to add the images. It messed with the permalink. I am using a different way to add images to my gallery and it has a proper URL.

    Thank you very much. I am still going to use your plugin for other purposes!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Trying to Redirect Image Attachment Page, not working’ is closed to new replies.