开发者

How to convert book.html to book in htacess

I have a book.html on my server

I need to access url like that http://www.domain.com/book

Is th开发者_Go百科at possible?

Thanks navi


I have a book.html on my server I need to create a rule some thing like that I need to access url like that http://www.domain.com/book it will work

That's simple mod_rewrite stuff. If you're using Apache with mod_rewrite enabled:

RewriteEngine On
RewriteRule ^book$ /book.html [NC,L]

Alternatively, you could use Apache's Multiviews for this purpose.


yes write this after RewriteEngine On,

RewrireRule ^book$ /book.html [NC,L]

if you want this rule for all .html files. write this

RewrireRule ^([a-z0-9]+)$ /$1.html [NC,L]


Specifically:

RewriteEngine On
RewriteRule ^book$ book.html [L]

Generally:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !\.html$
RewriteRule ^(.*)$ $1.html [L]
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜