Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
php and htaccess site
Old 03-15-2009, 11:32 PM php and htaccess site
Extreme Talker

Posts: 189
Trades: 0
i have coded my htaccess and php file so i can show all pages in 1 php file and have a different text file included for the content.
Code:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f [or]
RewriteCond %{REQUEST_FILENAME} !-d [or]
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule ^(.*).html$ /index.php?query=$1
PHP Code:
if (!$query) {$query home;}
$query 'includes/'.$query.'.txt';
include 
$query
if possible i want it so if the text file doesnt exist it will show my htaccess error 404 page

Last edited by simster; 03-16-2009 at 06:21 AM..
simster is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-16-2009, 02:33 PM Re: php and htaccess site
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
I assume the page name is being passed to the database? If it doesn't exist, write a redirect directly onto the index.php page.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 03-19-2009, 06:10 PM Re: php and htaccess site
Extreme Talker

Posts: 189
Trades: 0
any other suggestions.
simster is offline
Reply With Quote
View Public Profile
 
Old 03-20-2009, 02:37 AM Re: php and htaccess site
Skilled Talker

Posts: 84
Trades: 0
You can try checking the existence of a file before hand using the curl and the http methods (get/head) and if it fails to return the content redirect to a common file if not redirect to the requested page (make it permanent redirection 301).
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
- 1-888-869-HOST(4678)
Award winning Managed Hosting -
Please login or register to view this content. Registration is FREE

Managed Dedicated Servers. Reseller Discounts. 24/7 Impressive Tech Support
HivelocityDD is offline
Reply With Quote
View Public Profile
 
Old 03-20-2009, 05:59 AM Re: php and htaccess site
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
if possible i want it so if the text file doesnt exist it will show my htaccess error 404 page
And what does it currently do?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-20-2009, 11:11 AM Re: php and htaccess site
Defies a Status

Posts: 1,605
Trades: 0
Looks like I am not the only one who could not follow the logic in the OP.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 03-20-2009, 03:12 PM Re: php and htaccess site
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
I see, you're including a text file, not making a database query. Still, the solution isn't difficult. Check for the file, before any HTML is outputted, and if it doesn't exist, redirect to the 404 page, and be sure to send a real 404 header from that file. Either that, or include text from a file, say "404.inc", and send 404 header right in the index.php page, which won't matter since it appears you are rewriting that page URL.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to php and htaccess site
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24759 seconds with 12 queries