开发者

.htaccess help - not working

开发者 https://www.devze.com 2023-01-29 12:57 出处:网络
I want to rewrite all .php into .html,,, so i created a .htaccess file and added AddHandler开发者_开发技巧 application/x-httpd-php .php .html .htm

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
0

精彩评论

暂无评论...
验证码 换一张
取 消