web.configを.htacessに

web.configを.htacessに

WindowsサーバーからLinuxサーバーにサイトを移行しました。

うまくいきますが、インデックスページのみが機能し、他のページは機能しません。これを確認しました。 URL リダイレクトの使用 web.config の場合、Linux サーバーでは機能しません。誰でも変換して私にください。

    <rule name="aboutuspage" stopProcessing="true">
        <match url="^About-Us/" />
        <action type="Rewrite" url="/about-us.php" />
    </rule>
    <rule name="newseventspage" stopProcessing="true">
        <match url="^News-Events/" />
        <action type="Rewrite" url="/gallery.php" />
    </rule>
    <rule name="qualitypage" stopProcessing="true">
        <match url="^Quality/" />
        <action type="Rewrite" url="/quality.php" />
    </rule>
</rules>

誰でも助けてください

ベストアンサー1

以下のhtaccessコードを試してください。

# Make sure that the rewrite module has been enabled
<IfModule mod_rewrite.c>
# Enable the RewriteEngine may be duplicate.
RewriteEngine on
# Base of website
RewriteBase /
# Check if it is a PHP **file**
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
#Writing it without .php
RewriteRule ^(.*)$ $1.php
</IfModule>

これが解決策であれば、私の答えを受け入れて最終投票をしてください。

おすすめ記事