Enjoy an ad free experience by logging in. Not a member yet?
Register .
02-13-2012, 01:23 AM
PM User |
#1
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 =$ 7 [ 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
02-13-2012, 02:29 AM
PM User |
#2
God Emperor
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
What get is provided to create_image.php when using the rewrite?
02-13-2012, 02:51 AM
PM User |
#3
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
02-13-2012, 05:03 PM
PM User |
#4
God Emperor
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 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.
02-13-2012, 09:32 PM
PM User |
#5
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
02-13-2012, 11:07 PM
PM User |
#6
God Emperor
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Quote:
Originally Posted by
Sim
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.
02-13-2012, 11:35 PM
PM User |
#7
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
02-14-2012, 01:03 AM
PM User |
#8
God Emperor
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 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:
02-14-2012, 05:03 AM
PM User |
#9
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
Jump To Top of Thread
Thread Tools
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
HTML code is Off
All times are GMT +1. The time now is 04:19 PM .
Advertisement
Log in to turn off these ads.