我在root上有一個.htaccess文件。在根文件夾中有三個文件。向htaccess文件添加兩個重寫條件
- index.php文件上的index.php有兩種HREF事件和news.php文件
- article.php
- event.php
。
上article.php:
$articleId=123;
$articleTitle='First Article';
echo '<a href="'.$articleId.'&'.str_replace(" ","-",$articleTitle).'">Read More</a>';
,並event.php:
$eventId=789;
$eventTitle='First Event';
echo '<a href="'.$eventId.'&'.str_replace(" ","-",$eventTitle).'">Read More</a>';
以上兩種HREF的是對的index.php。
要處理重定向,我已經在htaccess文件上編寫了以下代碼。
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) article.php?arid=$1&$2
RewriteRule (.*) event.php?eveid=$1&$2
但是,當我添加第二個重寫線,系統沒有加載,當我刪除一個重寫空調系統工作正常。 任何人都可以幫我嗎?
在此先感謝,希望我明確提到這個問題。
什麼是你想在你的瀏覽器的文章和事件看到的網址嗎? – anubhava
@anubhavawhen文章:localhost/system/articleid-articletitle然後是event:localhost/system/eventid-eventtitle –
這裏有什麼'/ system /'文件夾?你把你的PHP文件放在裏面嗎? – anubhava