WordPress.org

Ready to get started?Download WordPress

Forums

URL Rewriting issue (1 post)

  1. skzap
    Member
    Posted 1 year ago #

    I have a problem to url rewrite with .htaccess a page on my wordpress, and I basically know nothing about wordpress.

    Let me explain in details. I''m making a page to display "coach profiles".

    I have a wordpress page called "lessons" which uses a custom page template called Page-Lessons.php (located in my theme directory)

    In this Page-Lessons.php, I just took the full-width template of my website and change the content to include a php file I made (called fichecoach.php) which contains everything I need to display.

    So far so good, my page http://www.lol-academy.net/lessons/?coach=TheFakeRasta which works as intended, except the url is very ugly. I want it to be http://www.lol-academy.net/lessons/TheFakeRasta

    So I went to my root folder .htaccess file and added this line at the top :
    RewriteRule ^lessons/([a-z]+)$ lessons/?coach=$1 [L]
    Gives me a 404

    Probably because the [L] states that its the end of the redirect and lessons/?coach=$1 is already a redirected url (from wordpress with permalinks set to /%post_name%/
    If I remove [L] I get error 500 (redirect loop ?)

    So I thought, lets just input the real url instead, so I change it to :
    RewriteRule ^lessons/([a-z]+)$ index.php?p=429&coach=$1 [L]
    And now, it works, except it gets redirected to /lessons/ and the querystring is not passed and url changes. (try to go to http://www.lol-academy.net/lessons/TheFakeRasta )

    I am really stuck on this problem, and I need help. As this is a commercial website, I'm willing to send a donation to someone who can unstuck me.

Topic Closed

This topic has been closed to new replies.

About this Topic