簡體   English   中英

如何使用 .htaccess 將 URL 重定向到新的 URL?

[英]How to redirect URL into a new URL using .htaccess?

我想使用 .htaccess 重定向頁面。 我正在使用代碼 igntiter 當用戶在地址欄中鍵入此 URL 時:

form.bixy.com/salesapp

然后他們按下回車鍵,URL 應該變成:

form.bixy.com/salesapp/administrator/addusr

我在salesapp文件夾中有這個 .htaccess

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteCond $1 !^(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 $1 !^(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 $1 !^(index\.php|images|stylesheets|system/application/sources/) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/?$ index.php  [L]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM