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
  1. #1
    New Coder
    Join Date
    Apr 2011
    Posts
    59
    Thanks
    8
    Thanked 0 Times in 0 Posts

    .htaccess adding in previous page to url

    Yes, yet another .htaccess question. xD

    My .htaccess file looks like this:

    Code:
    RewriteBase /
    
    RewriteEngine On
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^view/([^/]+)$ view.php?view=$1 [L]
    So if I try to access mysite.com/view/article, it works perfectly! The only problem I'm having is if there is a link on that page that is like /page.php it takes me to the URL of mysite.com/view/page.php

    Is there a rule I'm missing in my .htaccess that will point all /page requests to the base? I'd like the url to be mysite.com/page.php instead of mysite.com/view/page.php.

    I hope I was clear, I'm not the best at explaining these things!

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    I can't simulate this problem. Are you sure your link points to /page.php and not to page.php? If its missing the /, it will go from the directory in question according to HTML.
    If its missing the /, and you want it to go from root, add the <base> tag into the html head.

  • #3
    New Coder
    Join Date
    Apr 2011
    Posts
    59
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Oh, good catch! I feel so stupid now. Thanks so much!

  • #4
    New Coder
    Join Date
    Apr 2011
    Posts
    59
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quick question.

    I'm using the same .htaccess files and I have a page where I'm tracking the IP when people visit a certain page. I've noticed that every time I access a page it inserts both my IP and a different IP. I was wondering if this is something the .htaccess file could be doing because that's the only thing I can think of?


  •  

    Posting Permissions

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