简体   繁体   English

如何使用htaccess重写规则替换地址?

[英]HOW can i use htaccess rewrite rules to replace address?

How can i replace address using htaccess? 如何使用htaccess替换地址? using rewrite rules ... 使用重写规则...

for example, i want to replace www.my-site/articles/article1/25/ to this address www.my-site/my-articles/article1/ 例如,我要替换www.my-site/articles/article1/25/到此地址www.my-site/my-articles/article1/

Thank you in advance! 先感谢您!

Try using something along the lines of this... 尝试使用与此类似的东西...

<IfModule mod_rewrite.c>
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /"PAGENAME"?article=$1
RewriteCond %{HTTP_HOST} ^www.my-site.com$ [NC]
RewriteRule ^(.*)$ http://my-site.com/$1 [R=301,L]
</IfModule>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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