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 4 of 4

Thread: htacces problem

  1. #1
    New to the CF scene
    Join Date
    Jun 2013
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    htacces problem

    Good day all,

    I have this htacces file:

    [CODE]
    RewriteRule ^gadgy/users/(.*)\.html$ /index.php?page=$1&page2=users [L]
    RewriteRule ^gadgy/(.*).html$ /gadgy/index.php?page=$1 [L]
    [CODE]

    which is working fine for my url's, but only when I enter this url:
    http://#####.org/gadgy/users/xndero.html

    it automatically changes to:
    http://#####.org/gadgy/index.php?page=xndero&page2=users

    but as i did not us [R=301] in my htacces file, the url shouldnt change to the second url. Is there any way php is causing this? perhaps any header or ob_start?

  • #2
    Regular Coder
    Join Date
    Nov 2012
    Posts
    109
    Thanks
    6
    Thanked 12 Times in 12 Posts
    Possibly a redirect in index.php triggered by xndero? If all other URLs are working fine, it must be in the xndero page.

  • Users who have thanked Thyrosis for this post:

    xndero (06-06-2013)

  • #3
    New to the CF scene
    Join Date
    Jun 2013
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    yeah it worked, but i got my next problem. I'm redirecting there using:
    PHP Code:
    <a href="users/<?php echo $_SESSION['username']; ?>
    And it works, but if I click it multiple times, it starts stacking like this:

    users/users/users/users/xndero

    is there any way how I can prevent this from happening?
    I already tried this:
    PHP Code:
    <a href="<?php echo $base?>users/<?php echo $_SESSION['username']; ?>
    with $base being my home URL. But somehow this confuses my htacces file, so is there any other way to do this?

  • #4
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Quote Originally Posted by xndero View Post
    yeah it worked, but i got my next problem. I'm redirecting there using:
    PHP Code:
    <a href="users/<?php echo $_SESSION['username']; ?>
    And it works, but if I click it multiple times, it starts stacking like this:

    users/users/users/users/xndero

    is there any way how I can prevent this from happening?
    I already tried this:
    PHP Code:
    <a href="<?php echo $base?>users/<?php echo $_SESSION['username']; ?>
    with $base being my home URL. But somehow this confuses my htacces file, so is there any other way to do this?
    The way in which you are using your relative URL is causing you problems. Change it up to this and you should be fine:

    PHP Code:
    <a href="/gadgy/users/<?php echo $_SESSION['username']; ?>
    That's still a relative URL, but now it is relative to the website's root URL (rather than the current folder) so there will be no "stacking" issue this way.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting


  •  

    Tags for this Thread

    Posting Permissions

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