Appache RewriteRule有關問題

來源:互聯網
上載者:User
Appache RewriteRule問題
我想在地址欄裡輸入 http://web/cms/user_detail/74/41245/
然後將其重新導向到 http://web/cms/user_detail.php?id=74&contents_id=41245
可是RewriteRule沒起作用,報404錯誤

Not Found
The requested URL /cms/user_detail/74/41254/ was not found on this server.

這是為什麼呢?

httpd.conf的相關配置如下,請問還缺了什麼配置嗎?


---------------------------------------



LoadModule rewrite_module modules/mod_rewrite.so


Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all



Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all




ServerAdmin [email protected]
DocumentRoot D:\webroot
DirectoryIndex index.html index.htm index.php
ServerName web
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/user_detail/([0-9]+)/([0-9]+)/?$
RewriteRule ^(.*)$ /user_detail.php?id=%1&contents_id=%2


------解決方案--------------------
沒有找到頁面,你是不是用的架構,如果是的話看一下路由正則匹配
------解決方案--------------------
首先,把你的網站根目錄定位成cms,要不就不要用.conf檔案,在cms檔案夾中用.htaccess

然後再試試這個(刪除你原來的cond和rule):
XML code
RewriteRule /user_detail/([0-9]+)/([0-9]+)$ /user_detail.php?id=%1&contents_id=%2 [QSA,L]
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.