I've been trying to get .HTML files to process like .PHP files using the .htaccess file on my localhost. I've used the following one by one,
AddHandler application/x-httpd-php55 .html .htm
AddHandler application/x-mapp-php55 .php .html
AddHandler application/x-httpd-php .html .htm
AddHandler application/x-httpd-php5-script .html .htm
But none of the above worked for me.
I am using php5.5 and apach 2.4 in xampp
Is there any other configs in apache config file?
Need help
This question is clear, but no proper answers yet given. It seems nobody can answer it. Too bad, but it can happen
This has worked for me in the past.
AddHandler application/x-httpd-php .html
Also note that you must have mod_mime activated in Apache.
Also I assume your server is allowing the use of an .htaccess file and the AddHandler directive with either :-
AllowOverride All
or
AllowOverride FileInfo
My DEV HTACCESS looks like this
<IfModule mime_module>
#AddHandler application/x-httpd-ea-php72 .php .php7 .phtml
AddType application/x-httpd-php .php .htm .html .shtml
</IfModule>
I switch the Hashing for LIVE server though.
Hope this helps
Related
in htaccess file causes page to download. what I can. PHP version: 5.6.30.
I'm looking for a simple one line code that will use gzip to compress css, html, js, and php files on the web server. How can I do this with the .htaccess file or php.ini file? (My css and js files are in seperate folders in the root directory)
<Files *>
#Compress
SetOutputFilter GZIP
</Files>
You're most likely looking for mod_deflate module in Apache. Enable it in your httpd.conf and also enable .htaccess then add this code in your .htaccess under DOCUMENT_ROOT:
<FilesMatch "\\.(js|css|html|htm|php)$">
SetOutputFilter DEFLATE
</FilesMatch>
I want to rewrite all .php into .html,,, so i created a .htaccess file and added
AddHandler application/x-httpd-php .php .html .htm
but when it seems not working...
here i uploaded all files - http://www.fellowindian.com/ca/index.php & http://www.fellowindian.com/ca/page1.php
1: Do you have mod_mime installed on Apache.
2: Are you sure that .htaccess is executing.
Simple test would be to see if it can rewrite your urls to add / remove www from it.
Example:
Options +FollowSymLinks RewriteEngine
On RewriteBase / RewriteCond
%{HTTP_HOST} !^www\.mycee\.com$ [NC]
RewriteRule ^(.*)$
http://www.mycee.com/$1 [R=301,L]
3: Which user is the owner of the .htaccess file and what is its attributes?
4: Check that the AllowOverride directive is set in your apache config and not set to None.
Test by putting invalid directives in the .htaccess file and reloading the page.
If the apache error log doesn't show any errors, it's not executing.
5: If you're on shared hosting, check with your host if they have AllowOverride enabled or not.
Personally, I think the best place to put the AddType directive would be in apache's httpd.conf as .htaccess puts a performance hit on your server, but in the case of shared hosting, .htaccess is usually the only option available.
If you're trying to redirect something.php to something.html, you could do
RewriteEngine On
RewriteCond %{REQUEST_URI} .php$
RewriteRule (.*?).php $1.html
I have installed phppgadmin in a Ubuntu server and want to access it from another computer.
It said access denied when i typed:
http://<ip>/phppgadmin
The port 5432 is opened in the Ubuntu server but just for local ip.
Thanks
The /etc/apache2/conf.d/phppgadmin.conf configuration file by default keeps anyone but localhost from accessing PhpPgAdmin.
Add a line that makes a new allow rule for your IP, so it looks something like this:
<Location /phppgadmin>
Order deny,allow
Deny from all
Allow from [Your client IP]
</Location>
By the way, this kind of question is probably more appropriate for stackoverflow's sister site serverfault.com
I know this is an old question but since i stumbled on it trying to fix the "Failed to load resource: the server responded with a status of 403 (Forbidden)" error while trying to access phpPgAdmin from another computer and the given answers didn't work for me, I wanted to share my solution.
Ubuntu: 17.04; phpPgAdmin: 5.1
Solution:
Comment out Require local in /etc/apache2/conf-enabled/phppgadmin.conf and restart apache (sudo service apache2 reload)
<Directory /usr/share/phppgadmin>
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>
AllowOverride None
# Only allow connections from localhost:
# Require local
<IfModule mod_php.c>
php_flag magic_quotes_gpc Off
php_flag track_vars On
#php_value include_path .
</IfModule>
<IfModule !mod_php.c>
<IfModule mod_actions.c>
<IfModule mod_cgi.c>
AddType application/x-httpd-php .php
Action application/x-httpd-php /cgi-bin/php
</IfModule>
<IfModule mod_cgid.c>
AddType application/x-httpd-php .php
Action application/x-httpd-php /cgi-bin/php
</IfModule>
</IfModule>
</IfModule>
</Directory>
/etc/apache2/conf-enabled/phppgadmin.conf
This is an apache (or web server) issue. You're phppgadmin directory has a .htaccess file disallowing EVERYONE except localhost.
You need to either set it to Allow ALL or Allow (insert IP here)
Are you running Apache?
You need to change your permissions in the httpd.conf file or .htaccess
http://httpd.apache.org/docs/2.0/misc/security_tips.html
I want to share my solution as well.
Debian 10.1 with Apache 2.4.38 and phpPgAdmin 5.1 on 64-Bit ARM.
The following config will allow local and LAN access, but (for security reasons) NO WAN access.
/etc/apache2/conf-enabled/phppgadmin.conf
<Directory /usr/share/phppgadmin>
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>
AllowOverride None
# Only allow connections from localhost:
#Require local
Order deny,allow
Deny from all
Allow from ::1
Allow from 127.0.0.1
Allow from 192.168.0.0/16
Allow from 172.16.0.0/12
Allow from 10.0.0.0/8
<IfModule mod_php.c>
php_flag magic_quotes_gpc Off
php_flag track_vars On
#php_value include_path .
</IfModule>
<IfModule !mod_php.c>
<IfModule mod_actions.c>
<IfModule mod_cgi.c>
AddType application/x-httpd-php .php
Action application/x-httpd-php /cgi-bin/php
</IfModule>
<IfModule mod_cgid.c>
AddType application/x-httpd-php .php
Action application/x-httpd-php /cgi-bin/php
</IfModule>
</IfModule>
</IfModule>
</Directory>
AddHandler application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
...within a .htaccess file but my .phtml files are not running as php, they're just showing the code!
Have I missed something?
Is your server configured to read .htaccess files? To test this simply write random content in it. If the server still works the file is ignored otherwise it returns a 500 Internal Server Error.
To enable .hhtaccess file support in your configuration use the AllowOverride directive.