简体   繁体   中英

How to convert individual .php page to .html extension using URL rewriting

My .htaccess file code looks like

# -FrontPage-

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>

ErrorDocument 404 /404.html

Options +FollowSymLinks -MultiViews 
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteEngine on
RewriteRule ^([a-zA-Z0-9_-]+).html$ car.php?urlname=$1


RewriteEngine on
RewriteRule ^([a-zA-Z0-9_-]+).html$ america-tour-packages.php?urlname=$1


RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

This one is the individual page i have created in .php, and wanted to convert it's extension with .html using rewriting RULE but normal rule is not working, kindly suggest

>RewriteEngine on
>RewriteRule ^([a-zA-Z0-9_-]+).html$ america-tour-packages.php?urlname=$1

try this:

RewriteEngine on
RewriteRule ^(.*)\.html$ $1.php

when you will access test.html the system will look for: test.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM