Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 9 of 9

Thread: .htaccess help?

  1. #1

    Default .htaccess help?

    Hey,

    I'm trying to use RewriteEngine to alter the url's on my site but it keeps either doing something I don't want or giving an internal server error.

    Code:
    RewriteRule ^newsite/(.*)$ newsite/?p=$1 [L]
    that gives an internal server error.
    I want it to be like site.com/newsite/pagename

    I tried
    Code:
    RewriteRule ^newsite/(.*)/$ newsite/?p=$1 [L]
    That worked kind of but you HAD to have the / after the page name or else it wouldn't work and I don't want to have the /.

    It'd be cool if anyone could help.

    Cheers,
    Jamie

  2. #2
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    I think this may be the issue (not v. good with htaccess), you're telling the server to rewrite the url /newsite/<anything> to /newsite/?p=<anything>, which if you think about it logically will cause a loop of rewrites.

    Try something like:

    Code:
    RewriteRule ^newsite2/(.*)$ newsite/index.php?p=$1 [L]

  3. #3

    Default

    Just returns a 404 error. Cheers anyway
    Anyone else able to help?

  4. #4
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    That's strange as it worked perfectly on my localhost

  5. #5

    Default

    Quote Originally Posted by Invent View Post
    That's strange as it worked perfectly on my localhost
    Code:
    RewriteRule ^newsite/(.*)$ newsite/index.php?p=$1 [L]
    includes:
    Code:
    newsite/index.php.php
    It's treating index.php as part of the $1 variable.
    When I take index.php out I get the internal server error, LOL

    The only way to solve this is to do:
    Code:
    RewriteRule ^newsite/page/(.*)$ newsite/index.php?p=$1 [L]
    so it'd be like

    site.com/newsite/page/pagename

    But I don't want that either, haha.

    It's seriously rattling my brain

    Maybe i'm just being too fussy.

  6. #6
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    lol, I can't think properly at the moment (probably due to the fact its half four in the morning, lol), so I'll post a working method tomorrow for 'ya

  7. #7

    Default

    Thanks, Simon
    I'll keep on trying, doubt i'll get anywhere tho hahaha.

  8. #8
    Join Date
    Jul 2008
    Location
    Hastings, UK.
    Posts
    2,050
    Tokens
    0

    Latest Awards:

    Default

    Code:
    RewriteEngine On
    RewriteRule ^([^/]*)$ /newsite/index.php?p=$1 [L]
    But, that would be

    http://www.site.com/pagename

    which I suppose is better?

  9. #9

    Default

    Yeah, but the site's in a folder on the server called newsite

Posting Permissions

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