12 replies
  • SEO
  • |
I am trying to make SEO friendly urls. Im trying to make the url news.php?readmore=5 into /oddsmaker-sportsbook-bonus

The problem I'm having is that it doesnt change the URL in the browser for news.php?readmore=5 but if i type in /oddsmaker-sportsbook-bonus it shows up the way I want. I'm trying to get a link to readmore=5 to show the other url. Any advice? Here's my code.

Code:
RewriteRule ^oddsmaker-sportsbook-bonus/?$ news.php?readmore=5 [NC,L]
#mod #rewrite
  • Profile picture of the author Andy Fletcher
    That rewrite rule will take effect on the server. If you want to force it to change on the client as well you need the following (typed straight into the forum so untested!).

    Code:
    RewriteRule ^news.php?readmore=5$ oddsmaker-sportsbook-bonus/ [NC,R]
    Put that rule first and it'll force a 302 temporary redirect on the client if they go to news.php?readmore=5

    Then with your rule it'll convert it back internally and allow the script to figure out what to do.

    Hope that helps.

    Andy
    {{ DiscussionBoard.errors[829444].message }}
    • Profile picture of the author kristianw
      Andy,

      Not entirely sure i follow. I put that rule first like this

      Code:
      RewriteEngine On
      RewriteCond %{THE_REQUEST} ^news.php?readmore=5$
      RewriteRule ^news.php?readmore=5$ oddsmaker-sportsbook-bonus/ [NC,R]
      RewriteRule ^oddsmaker-sportsbook-bonus/?$ news.php?readmore=5 [NC,L]
      It still isn't working.

      Thanks for the help.
      Signature

      {{ DiscussionBoard.errors[830424].message }}
      • Profile picture of the author Andy Fletcher
        Originally Posted by kristianw View Post

        Andy,

        Not entirely sure i follow. I put that rule first like this

        Code:
        RewriteEngine On
        1. RewriteCond %{THE_REQUEST} ^news.php?readmore=5$
        2. RewriteRule ^news.php?readmore=5$ oddsmaker-sportsbook-bonus/ [NC,R]
        3. RewriteRule ^oddsmaker-sportsbook-bonus/?$ news.php?readmore=5 [NC,L]
        It still isn't working.

        Thanks for the help.
        Oh, whoops. My mistake.

        Line 1 is unnecessary since its just testing the same thing as the pattern match in line 2.

        Line 2 should have an L in the [] at the end so it doesn't do line 3 as well, which just swaps it back.

        Think that's right. If it's not I'll have to faff when I'm at my dev box.

        Cheers,

        Andy
        {{ DiscussionBoard.errors[830709].message }}
  • Profile picture of the author kristianw
    Hm.. still not working. If i go to Sportsbook Review - Sports Wagering, Top Online Sportsbooks - News: Odds Maker Sportsbook 100% Deposit Bonus it works correctly but still at Sportsbook Review - Sports Wagering, Top Online Sportsbooks - News: Odds Maker Sportsbook 100% Deposit Bonus it shows the dynamic url. Here is the updated code i am using
    Code:
    RewriteEngine On
    RewriteRule ^news.php?readmore=5$ oddsmaker-sportsbook-bonus/ [NC,R,L]
    RewriteRule ^oddsmaker-sportsbook-bonus/?$ news.php?readmore=5 [NC,L]
    I really appreciate all the help. I've been trying to make this work for 2 days and still cannot figure it out.

    Thanks.
    Signature

    {{ DiscussionBoard.errors[830783].message }}
  • Profile picture of the author kristianw
    Thanks Andy, I really appreciate it!
    Signature

    {{ DiscussionBoard.errors[832777].message }}
  • Profile picture of the author Andy Fletcher
    I'm an idiot. The initial pattern will have a / in front of it so neither of these rules will ever match -

    Code:
    RewriteEngine On
    RewriteRule ^/news.php?readmore=5$ oddsmaker-sportsbook-bonus/ [NC,R,L]
    RewriteRule ^/oddsmaker-sportsbook-bonus/?$ news.php?readmore=5 [NC,L]
    Try that.

    Cheers,

    Andy
    {{ DiscussionBoard.errors[833336].message }}
  • Profile picture of the author kristianw
    That still doesn't seem to do it. Now if i type in readmore=5 it still shows that URL. If I use the URL I want to work it comes up with a 404 error.
    Signature

    {{ DiscussionBoard.errors[833357].message }}
  • Profile picture of the author Andy Fletcher
    Oh I'm just being a bit of a failure all around today.

    You'll also need initial slashes on the replacement pattern as well -

    Code:
    RewriteEngine On
    RewriteRule ^/news.php?readmore=5$ /oddsmaker-sportsbook-bonus/ [NC,R,L]
    RewriteRule ^/oddsmaker-sportsbook-bonus/?$ /news.php?readmore=5 [NC,L]
    {{ DiscussionBoard.errors[833363].message }}
  • Profile picture of the author kristianw
    Hm.. Still having the same problem.. Don't feel like a failure either I've been struggling over this for days.
    Signature

    {{ DiscussionBoard.errors[833366].message }}
  • Profile picture of the author Andy Fletcher
    Hmm ... OK that's odd. Now that exactly matches what I've got on my server.

    I'm not going to be much more help without your hosting details. If you're happy for me to take a look inside your server please PM your login details but I understand if you're not happy to hand that kind of info out.

    Cheers,

    Andy
    {{ DiscussionBoard.errors[833382].message }}
  • Profile picture of the author 1 Marketing
    Yeah, Andy is right, it won't help without your hosting details...

    But be carefull before handing your login id to some one. As, once I had given my details to a programmer for cerain programming and instead of resolving the issue he changed the ID for adsense... When for some days I saw zero earnings on my site, I got amazed. When checked in detail, I come to know that there were no adsense on the sites... Rather all the earnings were flowing to the programmers' ID.
    {{ DiscussionBoard.errors[834509].message }}

Trending Topics