0
我的網址目前是這樣的:的.htaccess,使網址漂亮,但現在顯示在頁面上沒有內容
http://www.example.com/test
他們過去是這樣的:
http://www.example.com/post.php?post=test
這很好,但我的post.php頁面不再顯示任何內容,即它不顯示我的博客文章,標題和時間戳。
我.htaccess
看起來像這樣:
RewriteEngine on
RewriteBase/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+post\.php\?post=([^\s]+) [NC]
RewriteRule^%1? [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /post.php?post=/$1 [L]
和我post.php中網頁看起來是這樣的:
<?php
require("controller.php");
$post = $_GET['post'];
$rows = show_post($post);
foreach($rows as $row): ?>
<h1><?php echo htmlspecialchars($row['title'])?></h1>
<p><?php echo $row['post'] ?></p>
<p>Published on <?php echo $row['stamp'] ?></p>
<?php endforeach; ?>
<p><a href="index.php">Return to home</a></p>
我在做什麼錯?這是我的頭!讓我知道你是否需要更多信息。
如果你試試這個代碼:'1重寫規則^([^/\。] *)/ * $ post.php中後= $ [L]' – vikingmaster