【问题标题】:.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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-10
      • 2012-06-19
      • 2011-12-05
      • 1970-01-01
      • 2015-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多