/    Sign up×
Community /Pin to ProfileBookmark

i want to convert my php files iinto html extension when user clicks on a link from my page and in address bar .html extension shows in place of .php extension…

please! describe briefly

how to use .htaccess file and what are the functions of these code lines..

rewriteEngine on
rewriteRule ^cat/([^/]+).html$ category.php?category=$1
rewriteRule ^page/([^/]+)/([^/]+).html page.php?category=$1&sub_category=$2

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@NogDogSep 21.2006 — The first rewrite rule appears to be looking for pathnames in the form "cat/value.html" and converting it to "category.php?category=value". The second is looking for pathnames in the form of "page/value1/value2.html" and converting it to "page.php?category=value1&sub_category=value2".
Copy linkTweet thisAlerts:
@NyfaelSep 21.2006 — I have a need for the exact same thing (allowing .htm and .html files to read .php). I was told to put this in my .htaccess file:

<i>
</i>addhandler application/x-httpd-php .htm .html


It, however, is not working. I'm using php 4.3.11

do you know how I could fix this?

Sincerely,

Kerry
Copy linkTweet thisAlerts:
@NyfaelSep 21.2006 — got it to work, this is the code I ended up using (I also changed the php to version 5)

<i>
</i>AddHandler x-httpd-php5 .php .htm .html
AddHandler x-httpd-php .php4


-Kerry
×

Success!

Help @mahfooz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...