Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old April 25th, 2008, 09:02 AM
Toxinhead's Avatar
Toxinhead Toxinhead is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 147 Toxinhead User rank is Corporal (100 - 500 Reputation Level)Toxinhead User rank is Corporal (100 - 500 Reputation Level)Toxinhead User rank is Corporal (100 - 500 Reputation Level)Toxinhead User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 17 h 34 m 28 sec
Reputation Power: 3
Send a message via MSN to Toxinhead
Mod_rewrite .php?= problems???

Hey there again

This is my code here for rewriting a simple php?= url
PHP Code:
 RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain.com/wallpapers/(.*)/download/(.*)$ [NC]
RewriteRule ^wallpapers/(.*)/(.*)/(.*)/$ /wallpapers/$1/$2.php?number=$[NC


I was wondering why when i go here:

http://domain.com/wallpapers/$id/$name/2/

It returns a 404 error and shows this in the error log files

File does not exist: /home/gears/public_html/wallpapers/50/ice-prince/2.php

When it should be using this:

/home/gears/public_html/wallpapers/50/ice-prince.php


Thanks heaps in advance

Reply With Quote
  #2  
Old April 25th, 2008, 03:40 PM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,124 jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 10 h 58 m 38 sec
Reputation Power: 717
If you go to /wallpapers/$id/$name/2/ directly then the referrer will not be /wallpapers/$foo/download/$bar, which is a condition of the rewrite, so the rewrite fails. You have to either add a RewriteCond that allows the referrer to be empty, or remove it altogether.
Comments on this post
Toxinhead agrees: Thanks anyway
__________________
# Jeremy

Explain your problem instead of asking how to do what you decided was the solution.

Reply With Quote
  #3  
Old April 25th, 2008, 07:18 PM
Toxinhead's Avatar
Toxinhead Toxinhead is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 147 Toxinhead User rank is Corporal (100 - 500 Reputation Level)Toxinhead User rank is Corporal (100 - 500 Reputation Level)Toxinhead User rank is Corporal (100 - 500 Reputation Level)Toxinhead User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 17 h 34 m 28 sec
Reputation Power: 3
Send a message via MSN to Toxinhead
Hey can you please explain a little more? im really stuck
i took this line out and now it gives me a 404 error

PHP Code:
 RewriteCond %{HTTP_REFERER} !^http://(www\.)?animewallz.com/wallpapers/(.*)/download/(.*)$ [NC] 


and it shows this in the error log:

Fri Apr 25 19:14:28 2008] [error] [client 121.72.75.203] File does not exist: /home/gears/public_html/wallpapers/$id/$name/2.php

When it should be converting this

/home/gears/public_html/wallpapers/$id/$name.php?id=2

in to this pretty url

/home/gears/public_html/wallpapers/$id/$name/2

Reply With Quote
  #4  
Old April 26th, 2008, 06:14 AM
Toxinhead's Avatar
Toxinhead Toxinhead is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 147 Toxinhead User rank is Corporal (100 - 500 Reputation Level)Toxinhead User rank is Corporal (100 - 500 Reputation Level)Toxinhead User rank is Corporal (100 - 500 Reputation Level)Toxinhead User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 17 h 34 m 28 sec
Reputation Power: 3
Send a message via MSN to Toxinhead
Hey guys!

I finally got it working, i used this just incase you need to know

PHP Code:
 RewriteRule ^wallpapers/([-a-zA-Z0-9_]+)/([-a-zA-Z0-9_]+)/([-a-zA-Z0-9_]+)$ /wallpapers/$1/$2.php?prick=$[NC]
RewriteRule ^wallpapers/([-a-zA-Z0-9_]+)/([-a-zA-Z0-9_]+)/([-a-zA-Z0-9_]+)/$ /wallpapers/$1/$2.php?prick=$[NC

Reply With Quote
  #5  
Old April 28th, 2008, 11:16 AM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,124 jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 10 h 58 m 38 sec
Reputation Power: 717
You can make this one rule by using /?$ instead of /$.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Mod_rewrite .php?= problems???


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway