1
我有這樣一個URL:mod_rewrite的:改變單一的查詢字符串參數
http://foo.bar/index.php?page=this-is-the-page
現在,我必須找到這樣與mod_rewrite的拼寫錯誤的網址:unfortunally
http://foo.bar/index.php?page=this--is-the-page
所以遠遠我無法找到正確的RewriteRule:
Options -MultiViews
RewriteEngine On
RewriteCond %{QUERY_STRING} ^page=(\w+)--((\w+)(-(\w+))*)$
RewriteRule ^index\.php$ /index.php?page=%1-%2
問題似乎是「?」這應該意味着QSD。 無論如何,這是建議這樣的文章,例如mod_rewrite to change query string parameter name
那麼,我怎樣才能重新組織查詢字符串值與mod_rewrite只? SEO友好和黑客的PHP代碼是不是在這裏一個問題
它的工作原理!非常感謝你。不幸的是,我不明白它爲什麼有效,主要的區別是什麼。我認爲這是L參數?你能解釋一下嗎? – butterflyx
問題是在你的正則表達式中使用\ w +和。+。你可以在一些在線正則表達式測試中試試你的正則表達式來驗證這個 – anubhava
很高興知道它已經解決了。 – anubhava