如何使用 .htaccess 将 URL 重定向到新的 URL?
How to redirect URL into a new URL using .htaccess?
我想使用 .htaccess 重定向页面。我正在使用代码点火器
当用户在地址栏中输入 URL 时:
form.bixy.com/salesapp
然后他们按下回车键,URL 应该变成:
form.bixy.com/salesapp/administrator/addusr
我在 salesapp
文件夹中有这个 .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond !^(index\.php|images|stylesheets|system/application/sources/)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/
</IfModule>
如果删除行 RewriteRule ^(.*)$ index.php?/
,我得到 The requested URL was not found on this server.
我对.htaccess 知之甚少。非常感谢任何帮助,提前致谢。
编辑:
这是我当前放在 salesapp 文件夹中的 .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond !^(index\.php|images|stylesheets|system/application/sources/)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/?$ index.php [L]
RewriteRule ^/? /salesapp/administrator/addusr[NC,R=301,L]
</IfModule>
它仍然给我错误,但 URL 应该有效
The page isn’t redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
在 salesapp
你可以试试这个 .htaccess:
RewriteEngine on
RewriteBase /salesapp/
RewriteRule ^(?:administrator)?/?$ administrator/addusr [R=301,L,NC]
RewriteCond !^(index\.php|images|stylesheets|system/application/sources/) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/?$ index.php [L]
我想使用 .htaccess 重定向页面。我正在使用代码点火器 当用户在地址栏中输入 URL 时:
form.bixy.com/salesapp
然后他们按下回车键,URL 应该变成:
form.bixy.com/salesapp/administrator/addusr
我在 salesapp
文件夹中有这个 .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond !^(index\.php|images|stylesheets|system/application/sources/)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/
</IfModule>
如果删除行 RewriteRule ^(.*)$ index.php?/
,我得到 The requested URL was not found on this server.
我对.htaccess 知之甚少。非常感谢任何帮助,提前致谢。
编辑:
这是我当前放在 salesapp 文件夹中的 .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond !^(index\.php|images|stylesheets|system/application/sources/)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/?$ index.php [L]
RewriteRule ^/? /salesapp/administrator/addusr[NC,R=301,L]
</IfModule>
它仍然给我错误,但 URL 应该有效
The page isn’t redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
在 salesapp
你可以试试这个 .htaccess:
RewriteEngine on
RewriteBase /salesapp/
RewriteRule ^(?:administrator)?/?$ administrator/addusr [R=301,L,NC]
RewriteCond !^(index\.php|images|stylesheets|system/application/sources/) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/?$ index.php [L]