Please help with .htaccess rule!!

Discussion in 'Programming' started by Ntech25, Oct 27, 2009.

  1. #1
    Hi I had this rule working and it got deleted and now im stuck.


    I want to make my wallpapers.php point to mysite.com/video-games-wallpapers i had it working and lost the code.

    Could anyone please help me I remember was only 3 lines..
     
    Ntech25, Oct 27, 2009 IP
  2. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #2
    You may use PHP redirect in lieu of .htaccess redirect.
     
    it career, Oct 28, 2009 IP
  3. Ntech25

    Ntech25 Active Member

    Messages:
    372
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #3
    How do you do that? I liked how the htaccess worked. Just lost the code for it.
     
    Ntech25, Oct 28, 2009 IP
  4. Ntech25

    Ntech25 Active Member

    Messages:
    372
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^video-games-wallpapers/$ $wallpapers.php [NC]
    RewriteRule ^video-games-wallpapers$ $wallpapers.php [NC] code was similiar to this as far as I rember but it doesnt seem to work. When you make video-games-wallpapers It works.
     
    Ntech25, Oct 28, 2009 IP
  5. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Have a look at this article. It is a tutorial about .htaccess

    http://www.expertcore.org/viewtopic.php?f=41&t=440

    Hope this helps!
     
    NeoCambell, Oct 28, 2009 IP
  6. Ntech25

    Ntech25 Active Member

    Messages:
    372
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #6
    Ok Thanks.

    Also how come when I put this code

    RewriteRule ^wallpapers/$ wallpapers.php [nc]

    Link works. when you go to .com/wallpapers it loads up wallpapers.php.

    when you put this

    RewriteRule ^vide-games-wallpapers/$ wallpapers.php [nc]

    It does not work.. I even renamed wallpapers.php and still didn't work.
     
    Ntech25, Oct 28, 2009 IP
  7. insert

    insert Peon

    Messages:
    148
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    try to escape dashes... so replace "-" with "\-"
    like this:
    RewriteRule ^video\-games\-wallpapers/$ wallpapers.php [nc]
     
    insert, Oct 28, 2009 IP
  8. Ntech25

    Ntech25 Active Member

    Messages:
    372
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #8
    thanks it worked
     
    Ntech25, Dec 15, 2009 IP