0

Apache mod-rewriteCodeigniterで URL を書き換える必要があります

ページ名はexample.com/pages/page1 で、名前を変更する必要がありますexample.com/welcome.html

htaccessこのルールをファイルに書きました

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^pages/page1$ welcome.html [PT,L]

うまくいきません。どうやってやるの?。

4

1 に答える 1

0

これを試して:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_URI} ^sys.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} ^app.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

index.phpがインデックス ページであると仮定します。

そしてconfig.phpで変更します

$config['index_page'] = '';
于 2014-01-15T05:54:14.997 に答える