如何将 PHP 重定向到 URL 中使用连字符的 HTML


how to redirect php to html with hyphen in url

我想重定向包含带有php扩展名的下划线的网址,例如 app_development_company.php .htaccess文件中app-development-company.html

看看我的htaccess。

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^(.*'.js) gzip.php?type=js&file=$1
    RewriteRule ^(.*'.css) gzip.php?type=css&file=$1
    #RewriteBase   /
    RewriteCond %{HTTP_HOST} !^$
    RewriteCond %{HTTP_HOST} !^www'. [NC]
    RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    #RewriteRule    ^index'.html$       index.php   [L]
    RewriteRule    ^/$      index.php   [L]
    RewriteRule    ^iphone-app-development'.html$       iphone_development.php  [L]
    RewriteRule    ^mobile-app-development-jaipur'.html$    mobile-app-development-jaipur.php   [L]
    RewriteRule    ^android-app-development'.html$      android_app_development.php     [L]
    RewriteRule    ^404'.html$      404.php     [L]
    ErrorDocument  404 https://wedigtech.com/404.html
</IfModule>

请帮助我解决这个问题。

提前谢谢你

使用以下代码进行重定向

RewriteEngine On
RewriteBase /
RewriteRule index'.html index.php [NC,R]

另请参阅以下链接

https://css-tricks.com/how-to-redirect-indexhtml-to-indexphp/