Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-13-2012, 01:23 AM   PM User | #1
Sim
New Coder

 
Join Date: Feb 2009
Posts: 81
Thanks: 1
Thanked 1 Time in 1 Post
Sim is an unknown quantity at this point
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
Sim is offline   Reply With Quote
Old 02-13-2012, 02:29 AM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,645
Thanks: 4
Thanked 2,450 Times in 2,419 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
What get is provided to create_image.php when using the rewrite?
Fou-Lu is offline   Reply With Quote
Old 02-13-2012, 02:51 AM   PM User | #3
Sim
New Coder

 
Join Date: Feb 2009
Posts: 81
Thanks: 1
Thanked 1 Time in 1 Post
Sim is an unknown quantity at this point
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
Sim is offline   Reply With Quote
Old 02-13-2012, 05:03 PM   PM User | #4
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,645
Thanks: 4
Thanked 2,450 Times in 2,419 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
Fou-Lu is offline   Reply With Quote
Old 02-13-2012, 09:32 PM   PM User | #5
Sim
New Coder

 
Join Date: Feb 2009
Posts: 81
Thanks: 1
Thanked 1 Time in 1 Post
Sim is an unknown quantity at this point
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
Sim is offline   Reply With Quote
Old 02-13-2012, 11:07 PM   PM User | #6
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,645
Thanks: 4
Thanked 2,450 Times in 2,419 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
Fou-Lu is offline   Reply With Quote
Old 02-13-2012, 11:35 PM   PM User | #7
Sim
New Coder

 
Join Date: Feb 2009
Posts: 81
Thanks: 1
Thanked 1 Time in 1 Post
Sim is an unknown quantity at this point
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
Sim is offline   Reply With Quote
Old 02-14-2012, 01:03 AM   PM User | #8
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,645
Thanks: 4
Thanked 2,450 Times in 2,419 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
Sim (02-14-2012)
Old 02-14-2012, 05:03 AM   PM User | #9
Sim
New Coder

 
Join Date: Feb 2009
Posts: 81
Thanks: 1
Thanked 1 Time in 1 Post
Sim is an unknown quantity at this point
Thanks, works. Problem was the _. I replaced the _ with -
__________________
Online RPG Creator - Create Your Own Online RPG with no programming knoweldge
Sim is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:42 AM.


Advertisement
Log in to turn off these ads.