【问题标题】:.htaccess RewriteRule to change some php pages inside a specific directory.htaccess RewriteRule 更改特定目录中的一些 php 页面
【发布时间】:2019-09-18 22:55:09
【问题描述】:
我想更改位于 www.mywebsite.com/en/ 中的一些 .php 文件。
例如:
iscrizione.php --Rewrite to--> subscription.php
programma.php --Rewrite to--> program.php
我怎样才能用一些RewriteRule(s) 做到这一点?
【问题讨论】:
标签:
php
html
.htaccess
mod-rewrite
【解决方案1】:
你可以这样做
RewriteEngine On
RewriteCond %{REQUEST_URI} /iscrizione.php
RewriteRule ^(.*)$ https://www.website.com/en/subscription.php [R=301,L]
RewriteCond %{REQUEST_URI} /programma.php
RewriteRule ^(.*)$ https://www.website.com/en/program.php[R=301,L]
或者
Redirect 301 /en/iscrizione.php https://www.mywebsite.com/en/subscription.php
Redirect 301 /en/programma.php https://www.mywebsite.com/en/program.php