我.htaccess
是重寫規則未正常工作 - htaccess的
RewriteEngine On
RewriteRule ^pg/(.*)$ /manage/product_groups/$1
我想每個URL與pg/fetchPG
作爲第一和第二URL段重定向像
http://website.com/pg/fetchPG?name=Name_here
到
http://website.com/manage/product_groups/fetchPG?name=Name_here
我也想要除此之外的任何URL,應該被重定向到http://website.net
我試圖通過在PHP中編寫一些代碼來做到這一點,但它執行302
重定向。所以這不是我想要的。
mod_rewrite的日誌如下
[Sat Feb 25 17:18:03.920251 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc588c0a0/initial] [perdir /var/www/html/] add path info postfix: /var/www/html/pg -> /var/www/html/pg/fetchPG
[Sat Feb 25 17:18:03.920306 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc588c0a0/initial] [perdir /var/www/html/] strip per-dir prefix: /var/www/html/pg/fetchPG -> pg/fetchPG
[Sat Feb 25 17:18:03.920314 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc588c0a0/initial] [perdir /var/www/html/] applying pattern '^pg/(.*)$' to uri 'pg/fetchPG'
[Sat Feb 25 17:18:03.920338 2017] [rewrite:trace2] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc588c0a0/initial] [perdir /var/www/html/] rewrite 'pg/fetchPG' -> 'manage/product_groups/fetchPG'
[Sat Feb 25 17:18:03.920349 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc588c0a0/initial] [perdir /var/www/html/] add per-dir prefix: manage/product_groups/fetchPG -> /var/www/html/manage/product_groups/fetchPG
[Sat Feb 25 17:18:03.920363 2017] [rewrite:trace2] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc588c0a0/initial] [perdir /var/www/html/] trying to replace prefix /var/www/html/ with/
[Sat Feb 25 17:18:03.920375 2017] [rewrite:trace1] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc588c0a0/initial] [perdir /var/www/html/] internal redirect with /manage/product_groups/fetchPG [INTERNAL REDIRECT]
[Sat Feb 25 17:18:03.920959 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc5886330/initial/redir#1] [perdir /var/www/html/manage/] add path info postfix: /var/www/html/manage/product_groups -> /var/www/html/manage/product_groups/fetchPG
[Sat Feb 25 17:18:03.920976 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc5886330/initial/redir#1] [perdir /var/www/html/manage/] strip per-dir prefix: /var/www/html/manage/product_groups/fetchPG -> product_groups/fetchPG
[Sat Feb 25 17:18:03.920984 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc5886330/initial/redir#1] [perdir /var/www/html/manage/] applying pattern '(^|/)\\.' to uri 'product_groups/fetchPG'
[Sat Feb 25 17:18:03.920992 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc5886330/initial/redir#1] [perdir /var/www/html/manage/] add path info postfix: /var/www/html/manage/product_groups -> /var/www/html/manage/product_groups/fetchPG
[Sat Feb 25 17:18:03.920999 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc5886330/initial/redir#1] [perdir /var/www/html/manage/] strip per-dir prefix: /var/www/html/manage/product_groups/fetchPG -> product_groups/fetchPG
[Sat Feb 25 17:18:03.921006 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc5886330/initial/redir#1] [perdir /var/www/html/manage/] applying pattern '^(.*)$' to uri 'product_groups/fetchPG'
[Sat Feb 25 17:18:03.921020 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc5886330/initial/redir#1] [perdir /var/www/html/manage/] add path info postfix: /var/www/html/manage/product_groups -> /var/www/html/manage/product_groups/fetchPG
[Sat Feb 25 17:18:03.921027 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc5886330/initial/redir#1] [perdir /var/www/html/manage/] strip per-dir prefix: /var/www/html/manage/product_groups/fetchPG -> product_groups/fetchPG
[Sat Feb 25 17:18:03.921041 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc5886330/initial/redir#1] [perdir /var/www/html/manage/] applying pattern '^' to uri 'product_groups/fetchPG'
[Sat Feb 25 17:18:03.921055 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc5886330/initial/redir#1] [perdir /var/www/html/manage/] add path info postfix: /var/www/html/manage/product_groups -> /var/www/html/manage/product_groups/fetchPG
[Sat Feb 25 17:18:03.921063 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc5886330/initial/redir#1] [perdir /var/www/html/manage/] strip per-dir prefix: /var/www/html/manage/product_groups/fetchPG -> product_groups/fetchPG
[Sat Feb 25 17:18:03.921069 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc5886330/initial/redir#1] [perdir /var/www/html/manage/] applying pattern '^(.*)$' to uri 'product_groups/fetchPG'
[Sat Feb 25 17:18:03.921085 2017] [rewrite:trace2] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc5886330/initial/redir#1] [perdir /var/www/html/manage/] rewrite 'product_groups/fetchPG' -> 'index.php?/product_groups/fetchPG'
[Sat Feb 25 17:18:03.921093 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc5886330/initial/redir#1] split uri=index.php?/product_groups/fetchPG -> uri=index.php, args=/product_groups/fetchPG
[Sat Feb 25 17:18:03.921105 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc5886330/initial/redir#1] [perdir /var/www/html/manage/] add per-dir prefix: index.php -> /var/www/html/manage/index.php
[Sat Feb 25 17:18:03.921114 2017] [rewrite:trace2] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc5886330/initial/redir#1] [perdir /var/www/html/manage/] strip document_root prefix: /var/www/html/manage/index.php -> /manage/index.php
[Sat Feb 25 17:18:03.921120 2017] [rewrite:trace1] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc5886330/initial/redir#1] [perdir /var/www/html/manage/] internal redirect with /manage/index.php [INTERNAL REDIRECT]
[Sat Feb 25 17:18:03.921192 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc58794c0/initial/redir#2] [perdir /var/www/html/manage/] strip per-dir prefix: /var/www/html/manage/index.php -> index.php
[Sat Feb 25 17:18:03.921202 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc58794c0/initial/redir#2] [perdir /var/www/html/manage/] applying pattern '(^|/)\\.' to uri 'index.php'
[Sat Feb 25 17:18:03.921211 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc58794c0/initial/redir#2] [perdir /var/www/html/manage/] strip per-dir prefix: /var/www/html/manage/index.php -> index.php
[Sat Feb 25 17:18:03.921217 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc58794c0/initial/redir#2] [perdir /var/www/html/manage/] applying pattern '^(.*)$' to uri 'index.php'
[Sat Feb 25 17:18:03.921226 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc58794c0/initial/redir#2] [perdir /var/www/html/manage/] strip per-dir prefix: /var/www/html/manage/index.php -> index.php
[Sat Feb 25 17:18:03.921240 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc58794c0/initial/redir#2] [perdir /var/www/html/manage/] applying pattern '^' to uri 'index.php'
[Sat Feb 25 17:18:03.921255 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc58794c0/initial/redir#2] [perdir /var/www/html/manage/] strip per-dir prefix: /var/www/html/manage/index.php -> index.php
[Sat Feb 25 17:18:03.921262 2017] [rewrite:trace3] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc58794c0/initial/redir#2] [perdir /var/www/html/manage/] applying pattern '^(.*)$' to uri 'index.php'
[Sat Feb 25 17:18:03.921274 2017] [rewrite:trace1] [pid 8296] mod_rewrite.c(468): [client 39.32.81.36:26799] 39.32.81.36 - - [website.com/sid#7efcd2c4ec80][rid#7efcc58794c0/initial/redir#2] [perdir /var/www/html/manage/] pass through /var/www/html/manage/index.php
是/ var/www/html等/管理/ product_groups/fetchPG正確的最終路徑? –