htaccess url为博客重写规则

时间:2022-09-26 10:43:13

Hi I got an problem with my htaccess url rewirte rule i want to rewrite the following urls

嗨,我的htaccess url rewirte规则有问题,我想重写以下网址

http://myhomepage.com/agb.html to http://myhomepage.com/agb

http://myhomepage.com/agb.html到http://myhomepage.com/agb

and

http://myhomepage.com//blog.php?archiv=webdesign-templates to http://myhomepage.com/blog/webdesign-templates

http://myhomepage.com//blog.php?archiv=webdesign-templates to http://myhomepage.com/blog/webdesign-templates

this is my actual .htaccess

这是我的实际.htaccess

Options +FollowSymLinks
RewriteEngine on

RewriteRule /blog/(.*) blog.php?archiv=$1

RewriteRule /kontakt kontakt.php

how to do this in the right way please need some help buddys. Thanks

如何以正确的方式做到这一点请需要一些帮助伙伴。谢谢

1 个解决方案

#1


1  

This should work for you:

这应该适合你:

RewriteEngine On
RewriteBase /

RewriteRule ^blog/([-a-zA-Z0-9]+)$ blog.php?archiv=$1 [L,QSA]
RewriteRule ^blog/webdesign-templates/([-a-zA-Z0-9]+)$ blog.php?archiv=webdesign-templates&titel=$1 [L, QSA]
RewriteRule ^kontakt$ kontakt.php [L, QSA] 
RewriteRule ^([-a-zA-Z0-9]+)$ $1.html [L, QSA]

#1


1  

This should work for you:

这应该适合你:

RewriteEngine On
RewriteBase /

RewriteRule ^blog/([-a-zA-Z0-9]+)$ blog.php?archiv=$1 [L,QSA]
RewriteRule ^blog/webdesign-templates/([-a-zA-Z0-9]+)$ blog.php?archiv=webdesign-templates&titel=$1 [L, QSA]
RewriteRule ^kontakt$ kontakt.php [L, QSA] 
RewriteRule ^([-a-zA-Z0-9]+)$ $1.html [L, QSA]