SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    SitePoint Wizard
    Join Date
    May 2003
    Location
    Berlin, Germany
    Posts
    1,829
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Small Mod Rewrite problem

    My .htaccess file:
    Code:
    RewriteEngine On
    RewriteRule !(^skins/.*|^html/.*)$ index.php
    When I access the directory alone I get a 404 page cannot be displayed error on my live server. On my local server it works all perfectly. When I directly access index.php it works ok.

    Anyone ?

  2. #2
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Access which directory? And what version of Apache are you running and what version is your host running?

  3. #3
    SitePoint Wizard
    Join Date
    May 2003
    Location
    Berlin, Germany
    Posts
    1,829
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not sure as of yet, asking him.

    THis is the dorectory & file tree:

    intranet
    --index.php
    --skins
    ---1
    ----common.php
    --other


  4. #4
    SitePoint Wizard
    Join Date
    May 2003
    Location
    Berlin, Germany
    Posts
    1,829
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think it's 1.3.28, both on my live and local servers.

  5. #5
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Hmm, try changing this line, think you need the flag at the end.
    Code:
     RewriteRule !(^skins/.*|^html/.*)$ index.php [L]
    Didn't pick up on that the first time I read your post

  6. #6
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The [L] flags won't solve your problems.

    > When I access the directory alone I get a 404 page
    > cannot be displayed error on my live server.
    I think you mean that:
    example.com will have a 404
    example.com/index.php will work
    right ?

    I think you need to add this in your .htaccess

    DirectoryIndex index.php



    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  7. #7
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by pippo
    The [L] flags won't solve your problems.

    > When I access the directory alone I get a 404 page
    > cannot be displayed error on my live server.
    I think you mean that:
    example.com will have a 404
    example.com/index.php will work
    right ?

    I think you need to add this in your .htaccess

    DirectoryIndex index.php



    I think he means more along the lines of

    http://www.example.com/skins/ <-- wont work
    http://www.example.com/skins/index.php <-- will work

    To be honest I can't really help, I have a little knowledge of mod_rewrite and I'm just doing my best to cover as much as I can for pippo while he's busy and can't always reply straight away. I'm just not in the same league as him, that's all...

    Edit:


    Unless you're using this URL

    http://www.example.com/skins

    that won't work as you have a trailing slash in your regex, try changing it to this and see if it helps
    Code:
     RewriteRule !(^skins?/.*|^html?/.*)$ index.php [L]

  8. #8
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cam your help is really appreciated...
    I encourage you to continue without worring about eventually mistakes, I'm still doing mistakes...

    I think I started using mod_rewrite in 2000/2001 and It took me a lot to learn it, still learning...


    Go cam go
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  9. #9
    SitePoint Wizard
    Join Date
    May 2003
    Location
    Berlin, Germany
    Posts
    1,829
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Excerpt from reply of my host:

    Firstly, why isn't the "intranet" located in the intranet folder in the root directory? Rather you have it inside the ../forums/intranet/ .... why is this? The intranet.wildfiregames.com subdomain will never work unless you use it from wildfiregames.com/intranet... it's already setup for DNS, so you should align it to that folder.

    I also noticed your .htaccess file is as follows....

    RewriteEngine On
    RewriteRule ^intranet/(.*)/(.*)$ /intranet/index.php

    This is not the same one you posted on SitePoint. Did you make some changes, in an effort to make it work? Also, telling it to access from /intranet/index.php would be incorrect because then you're telling it essentially to write from http://www.wildfiregames.com/intranet/ (going back one level because of the "/" ) which currently doesn't exist. Leave off the trailing slash if you intend to use wildfiregames.com/forums/intranet/.
    Didn't work though. Awaiting moreu pdates from eitherh im or you guys. Your help is a lot appreciated.

  10. #10
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tim,
    you should post here where you are going to use the .htaccess and what you are going to translate with mod_rewrite...


    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  11. #11
    SitePoint Wizard
    Join Date
    May 2003
    Location
    Berlin, Germany
    Posts
    1,829
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For the sake of easyness I transformed the whole thing to intranet.wildfiregames.com
    The baseUrl of my PHP Pathvars class is now '/'.

    I am trying to refer everything that comes in to http://intranet.wildfiregames.com/index.php

    My .htaccess file:
    RewriteEngine ON
    RewriteRule ^/intranet/(.*)/(.*)$ /intranet/index.php

    Tried every possible combo for the mod rewrite, even absolute paths and still no success. Cann access htp://intranet.wildfiregames.com/ but not stuff like http://intranet.wildfiregames.com/task/0ad/view/webdev/.

    This is starting to get on my (otherwise cool )nerves. :s

  12. #12
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I said a lot of times:

    Within .htaccess never use
    RewriteRule ^/etc
    but use
    RewriteRule ^etc

    Try:

    RewriteEngine On
    RewriteRule ^[^.]*$ /index.php [L]

    so
    http://intranet.wildfiregames.com/what/you/want/
    will go to
    http://intranet.wildfiregames.com/index.php


    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  13. #13
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The rules I wrote can be adjust more,
    but I think it's a good start to play with...



    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  14. #14
    SitePoint Wizard
    Join Date
    May 2003
    Location
    Berlin, Germany
    Posts
    1,829
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay pippo, and where shall I ship the money ?

    Wohoo! Works like perfectionism himself!!!!!!!


    (sorry got a bit carried away over our evetual success )

    Thanks a lot man, I owe you something.


Bookmarks

Posting Permissions

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