2015-12-15 88 views
1

一個非常普遍的問題,但無法解決問題。動態網址變成SEO友好的網址

我想

http://website.de/page.php?module=helios 

http://website.de/page/helios 

我已經試過很多的.htaccess代碼像這樣的,但仍然頁面發送給404

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ page.php?module=$1 

請提供一些建議。

+0

對不起,我已編輯它。 – Adas

+0

頁面不是目錄,它是一個page.php – Adas

回答

2

試試這個規則在你的站點根目錄的.htaccess:

Options -MultiViews 
RewriteEngine on 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^page/([^/]+)/?$ page.php?module=$1 [L,NC,QSA] 
+0

以及我無法理解,我已經嘗試了包括你的所有答案,但仍然頁面發送到404頁面。 – Adas

+0

欲瞭解更多信息,我也使用其他代碼在htaccess中,像刪除php擴展,子域。我不認爲這些影響。 – Adas

+0

我明白了。我只是把你的代碼放在其他代碼的頂部,並處理所有事情。只是最後的信息需要,我沒有使用「Options -MultiViews」從你的代碼,但仍然工作。那麼是否有必要使用? – Adas

0

嘗試...

RewriteRule ^page/([^/]*)/$ /page.php?module=$1 [L] 
0

使用此使用的基本路徑

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^page/(.*)$ page.php?module=$1