Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Pretty URL problem

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #25730
    mattvot
    Member

    Using the following .htaccess I could go to site.com/about/ and that would work fine, but site.com/about (without the last / ) would not work.

    Code:
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /

    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteCond %{SCRIPT_FILENAME} !-f

    RewriteRule ^(.*)/$ ./index.php?p=$1

    ErrorDocument 404 /404/

    But doing this won’t work either

    Code:
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /

    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteCond %{SCRIPT_FILENAME} !-f

    RewriteRule ^(.*)/$ ./index.php?p=$1
    RewriteRule ^(.*)$ ./index.php?p=$1

    ErrorDocument 404 /404/

    Anyone know how I can solve this? Thanks

    #62121
    mattvot
    Member

    Yeh, that’s where I got the idea off of lol. That’s fine, site.com/about will work, but not site.com/about/. It’s very weird

    #62141
    mattvot
    Member

    Thanks so much, but it still doesn’t work. I understand why your solution should work, but mine does not. I looked at the page you referred from and I looked at the fist option of making both trailing slash and no trailing slash work. I figure its better to see why this doesn’t work before forcing the /. It works because the trailing slash has the REGEX optional character ? stating that the trailing slash is optional, yet it doesn’t work.

    I’ve attached a much striped down version of the site I use so you don’t have to set up your own PHP engine for managing pages. Thanks for your help. I am totally confused. The site (a web app) will eventually help all designers and developers.

    #62143
    mattvot
    Member
    #62150
    mattvot
    Member

    Yeh, it’s weird. I don’t understand .htaccess. It’s like you spend all this time learning and then its a waste when, probably, such a small thing is not working, and it could be probably be so simple, nobody covers it in their tuts. Arrgh, help please ;)

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Other’ is closed to new topics and replies.