Regex 使用htaccess重写codeigniter URL

Regex 使用htaccess重写codeigniter URL,regex,apache,.htaccess,codeigniter,mod-rewrite,Regex,Apache,.htaccess,Codeigniter,Mod Rewrite,我需要通过Codeigniter中的apachemod rewrite重写URL 页面名称为example.com/pages/page1 我需要将其重命名为example.com/welcome.html 我在htaccess文件中编写了这些规则 RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^pages/page1$ welcome.ht

我需要通过Codeigniter中的apachemod rewrite重写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]
它不起作用。我该怎么做?

试试这个:

<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>

所以,如果您直接访问
example.com/welcome.html
它显示得好吗?我使用了Codeigniter“路由”,我做了我需要的:)
$config['index_page'] = '';