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 9 of 9
  1. #1
    Sim
    Sim is offline
    New Coder
    Join Date
    Feb 2009
    Posts
    81
    Thanks
    1
    Thanked 1 Time in 1 Post

    mod rewrite problem... want friendly url with image generated from file

    My .htaccess

    PHP Code:
    RewriteEngine On

    RewriteRule 
    ^img_(.*)_(.*)_(.*)_(.*)_(.*)_(.*)_(.*)$ /create_image.php?id=$1&hour=$2&min=$3&day=$4&month=$5&YYYY=$6&cruise=$[NC,L

    My URL of file:
    mydomain.com/img_0_00_00_01_01_2014_ocenia_cruises.png

    anyone know what I am doing wrong? if I use create_image.php with all $_GET's set, it works fine, but with my friendly url, it doesn't work..
    Online RPG Creator - Create Your Own Online RPG with no programming knoweldge

  • #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
    What get is provided to create_image.php when using the rewrite?

  • #3
    Sim
    Sim is offline
    New Coder
    Join Date
    Feb 2009
    Posts
    81
    Thanks
    1
    Thanked 1 Time in 1 Post
    create_image.php?id=0&hour=00&min=00&day=01&month=01&YYYY=2014&cruise=ocenia_cruises.png
    Online RPG Creator - Create Your Own Online RPG with no programming knoweldge

  • #4
    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
    Looks to me like its working fine then. If you are retrieving all of those variables from get using the rewrite, then there is no problem here.

  • #5
    Sim
    Sim is offline
    New Coder
    Join Date
    Feb 2009
    Posts
    81
    Thanks
    1
    Thanked 1 Time in 1 Post
    Has to be some problem somewhere, the url keeps saying not found when using my friendly url in 1st post..
    Online RPG Creator - Create Your Own Online RPG with no programming knoweldge

  • #6
    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
    Quote Originally Posted by Sim View Post
    Has to be some problem somewhere, the url keeps saying not found when using my friendly url in 1st post..
    What's not found? You just posted the querystring provided to the page when accessed by a mod rewrite, so I presumed there was no issue with that.

  • #7
    Sim
    Sim is offline
    New Coder
    Join Date
    Feb 2009
    Posts
    81
    Thanks
    1
    Thanked 1 Time in 1 Post
    I got the URL mydomain.com/img_0_00_00_01_01_2014_ocenia_cruises.png (WHICH physically does not exist). It says "page not found". It should use the create_image.php file to display this image which works perfect if i go to mydomain.com/create_image.php?gets_here which is the reason I attempted to create this .htaccess file.
    Online RPG Creator - Create Your Own Online RPG with no programming knoweldge

  • #8
    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
    So you get a 404 then.
    You can't use this pattern to match the above since there is an underscore in the filename. It also assumes you have rewrite, so you better check that:
    Code:
    <IfModule mod_rewrite.c>
        SetEnv _HAS_MODREWRITE "ENABLED"
        RewriteEngine On
        RewriteRule ^img_(.*)_(.*)_(.*)_(.*)_(.*)_(.*)_(.*)$ /create_image.php?id=$1&hour=$2&min=$3&day=$4&month=$5&YYYY=$6&cruise=$7 [NC,L]  
    </IfModule>
    Try again without the use of the underscore in the name of the image (or refine your search pattern). If it doesn't work, check a phpinfo page to ensure that there is a server variable under _HAS_MODREWRITE. If its not there, you don't have the rewrite engine available.

  • Users who have thanked Fou-Lu for this post:

    Sim (02-14-2012)

  • #9
    Sim
    Sim is offline
    New Coder
    Join Date
    Feb 2009
    Posts
    81
    Thanks
    1
    Thanked 1 Time in 1 Post
    Thanks, works. Problem was the _. I replaced the _ with -
    Online RPG Creator - Create Your Own Online RPG with no programming knoweldge


  •  

    Posting Permissions

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