logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: need help with apache /php
Author
shalvasoft



Joined: 01 Jun 2015
Posts: 1
Location: Tbilisi

PostPosted: Mon 01 Jun '15 20:44    Post subject: need help with apache /php Reply with quote

I have problem with apache / php
this is my htaccess code

Code:
RewriteEngine on

# Follow symbolic links.
Options +FollowSymLinks

# Redirect to domain with www.
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Same for HTTPS:
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# Ensure all directory URLs have a trailing slash.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\/$
RewriteCond %{REQUEST_URI} !\/[^\/]*\.[^\/]+$
RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI}/ [L,R=301]
# Same for HTTPS:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\/$
RewriteCond %{REQUEST_URI} !\/[^\/]*\.[^\/]+$
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI}/ [L,R=301]

# Rewrite for links
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

# Custom error pages.
ErrorDocument 400 /errordocs/error400.html
ErrorDocument 401 /errordocs/error401.html
ErrorDocument 403 /errordocs/error403.html
ErrorDocument 404 /errordocs/error404.html
ErrorDocument 500 /errordocs/error500.html

# Prevent viewing of htaccess file.
<Files .htaccess>
order allow,deny
deny from all
</Files>

# Compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

when I try to call example 404 error with php
with this code
Code:
header("HTTP/1.0 404 Not Found");
exit;

it is doing nothing.
I`m sure that link and file is correct.
So what is the problem?
Question Question Question
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 17 Jun '15 17:36    Post subject: Reply with quote

You problem is your dispatch file (index.php) since all requests go through that. There you have to handle a 404 request with the correct header.

if that code is from an existing page you may try

Code:

<?php
header('HTTP/1.0 404 Not Found');
?>
Whoops file not found
Back to top


Reply to topic   Topic: need help with apache /php View previous topic :: View next topic
Post new topic   Forum Index -> Apache