2014-01-27 103 views
0

我用修改WordPress網站網址看起來像這樣的工作到.htaccess文件?在WordPress的重寫URL

RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 

# uploaded files 
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L] 

# add a trailing slash to /wp-admin 
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] 

RewriteCond %{REQUEST_FILENAME} -f [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule^- [L] 
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L] 
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L] 
RewriteRule . index.php [L] 

新增信息:這個WordPress網站使用PHP代碼的插件,我們在從不正常的WordPress的部分其他MySQL數據庫表的內容拉動。

if (isset($wp_query->query_vars['refid'])) { 

$refid = $wp_query->query_vars['refid']; 

$safe_id = mysql_real_escape_string($refid); 
$SQL = "select publication_title, publication_content, publication_date from publications where publication_url_name = '$safe_id'" ; 
$result = mysql_query($SQL); 
while ($db_field = mysql_fetch_assoc($result)) { 
    $detail_data = $db_field['publication_content']; 
    $title = $db_field['publication_title']; 
    $date = $db_field['publication_date']; 
} 
mysql_close($db_handle); 

$pub_date = date("F d, Y",strtotime($date)); 
echo "<h1>" . $title . "</h1>"; 
echo "<span class=\"date\">" . $pub_date . "</span>"; 
echo $detail_data; 
} 

我試過類似的東西,但沒有奏效。有什麼建議麼?

RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 

# uploaded files 
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L] 

# add a trailing slash to /wp-admin 
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] 

RewriteCond %{QUERY_STRING} (?:^|&)refid=([^&]+)(?:$|&) 
RewriteRule ^detail-page/$ detail-page/%1? 

RewriteCond %{REQUEST_FILENAME} -f [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule^- [L] 
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L] 
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L] 
RewriteRule . index.php [L] 
+0

如果這個來自'?REFID = AHLA - 臨牀研究實踐,guide'? –

+0

@RahilWazir我爲我的問題添加了更多信息。謝謝。 – Jeff

回答