WordPress.org

Ready to get started?Download WordPress

Forums

htaccess 301 redirects issues (1 post)

  1. eGantz
    Member
    Posted 9 months ago #

    Hey guys,
    I need some HELP ! :(

    I set up the permalinks to be %postname% to use the links as http://domain.com/page-name/

    and then I tried to remove the slugs because the theme adds an automatic slugs, for example: http://domain.com/portfolio/item-name/
    and I don't really need it that way.

    So I wrote some ReWrites to remove it:
    RewriteRule ^portfolio/(.+)/$ /$1 [R=301,L]
    RewriteRule ^services/(.+)/$ /$1 [R=301,L]
    RewriteRule ^staff/(.+)/$ /$1 [R=301,L]
    RewriteRule ^faq/(.+)/$ /$1 [R=301,L]
    RewriteRule ^testimonials/(.+)/$ /$1 [R=301,L]
    RewriteRule ^acf/(.+)/$ /$1 [R=301,L]
    RewriteRule ^/(.+)/$ /$1 [R=301,L]
    RewriteRule ^sidebar/(.+)/$ /$1 [R=301,L]

    It does work. all slugs has been removed.

    The problem begins after I've added some 301 redirects from old pages to new ones (SEO work).

    As you probably know, a trailing slash is a character that added automatically to every link within a web browser, the problem is when I'm trying to copy a link or to use a link with that trailing slash, it gets me to a broken 404 page. Weird !

    for example:
    Works: http://domain.com/page-name
    Doesn't work: http://domain.com/page-name/

    Here's a live example:
    That link works
    That Link doesn't work

    So as I said, it doesn't happens with all the links, only with certain links that I redirected them. everything looks normal but still a problem.
    Even if I use a straight Hebrew language in the 301 redirect role or an the encoding method it doesn't work, for example:
    this is the hebrew version of that role for the live example:
    RewriteRule ^מה-זה-סטאפ/?$ "\/טיפול-רחב-היקף-סטאפ/" [R=301,L]

    this is the encoding version of it:
    RewriteRule ^%D7%9E%D7%94-%D7%96%D7%94-%D7%A1%D7%98%D7%90%D7%A4/?$ "\/%D7%98%D7%99%D7%A4%D7%95%D7%9C-%D7%A8%D7%97%D7%91-%D7%94%D7%99%D7%A7%D7%A3-%D7%A1%D7%98%D7%90%D7%A4/" [R=301,L]

    I've tried to ask ppl in stackoverflow.com and other places, tried to read a lot but no avail.

    I'm losing my mind :)

    Thanks in advance !

Reply

You must log in to post.

About this Topic