Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2007
    Location
    In front of PC
    Posts
    96
    Thanks
    25
    Thanked 3 Times in 3 Posts

    Question htaccess rewrite help.

    Hi all,
    I'm trying to write a rewrite rule with no luck.

    The url
    http://www.mysite.com/play/play-12-w...e-to-play.html

    needs to be redirected to
    http://www.mysite.com/play/play.php?gameid=12

    Its a wordpress site. I just add the lines in Red.

    I tried the following rewrite.
    Code:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /
    
    #RewriteRule ^play/play-([0-9]+)-([a-z0-9\-]+)\.html /play/play.php?id=$1 [NC]
    RewriteRule ^(.*)/play/play-([0-9]+)-(.*)$ $1/play/play.php?id=$2 [NC]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    Learning never ends....

  • #2
    New Coder
    Join Date
    Oct 2007
    Location
    In front of PC
    Posts
    96
    Thanks
    25
    Thanked 3 Times in 3 Posts

    Fixed this.......

    Quote Originally Posted by tamilsweet View Post
    Hi all,
    I'm trying to write a rewrite rule with no luck.

    The url
    http://www.mysite.com/play/play-12-w...e-to-play.html

    needs to be redirected to
    http://www.mysite.com/play/play.php?gameid=12

    Its a wordpress site. I just add the lines in Red.

    I tried the following rewrite.
    Code:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /
    
    #RewriteRule ^play/play-([0-9]+)-([a-z0-9\-]+)\.html /play/play.php?id=$1 [NC]
    RewriteRule ^(.*)/play/play-([0-9]+)-(.*)$ $1/play/play.php?id=$2 [NC]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Added L(for last) to the rule.


    RewriteRule ^play/play-([0-9]+)-([a-z0-9\-]+)\.html /play/play.php?id=$1 [NC, L]
    Learning never ends....


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •