Appache rewriterule Problems

Source: Internet
Author: User
I want to enter http://web/cms/user_detail/74/41245/in the Address bar.
Then redirect it to http://web/cms/user_detail.php?id=74&contents_id=41245
But Rewriterule didn't work. 404 error

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

What is this for?

Httpd.conf the related configuration is as follows, what is missing the configuration?


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



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 mike@sina.com
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


Reply to discussion (solution)

The first to send a post about PHP, long time, unexpectedly a reply to the people are not, hey

Did not find the page, you are not using the frame, if so look at the route regular match

Did not find the page, you are not using the frame, if so look at the route regular match

Seems to be an expert ah, worship a first, I used cake PHP

Ask under the route regular match, how to see, in which configuration?
The environment I use is windows+php integrated environment CoreAMP.exe

Is there any error in the configuration of my httpd.conf?

First, locate your website root directory as a CMS, or do not use the. conf file in the CMS folder. htaccess

Then try this again (delete your original cond and rule):

rewriterule/user_detail/([0-9]+)/([0-9]+) $/user_detail.php?id=%1&contents_id=%2 [QSA,L]

Did not find the page, you are not using the frame, if so look at the route regular match

My routes.php is this:
$Route->connect ('/', Array (' controller ' = ' top ', ' action ' = ' index ');
$Route->connect ('/pages/* ', Array (' controller ' = ' pages ', ' action ' = ' display ');
$Route->connect ('/tests ', Array (' controller ' = ' tests ', ' action ' = ' index '));
?>

How do I change it?

First, locate your website root directory as a CMS, or do not use the. conf file in the CMS folder. htaccess

Then try this again (delete your original cond and rule):

XML Code

rewriterule/user_detail/([0-9]+)/([0-9]+) $/user_detail.php?id=%1&contents_id=%2 [QSA,L]

I deleted the hconf file, and then my. htaccess file says so, or not.

Rewriteengine on
Rewritecond%{https} on [NC]
Rewriterule (. *) Http://%{server_name}%{request_uri} [R,l]
rewriterule/user_detail/([0-9]+)/([0-9]+) $/user_detail.php?id=%1&contents_id=%2 [QSA,L]

Alas, it's my own fix, the Almighty jar, it didn't work.


Rewritecond%{https} on [NC]  rewriterule (. *) Http://%{server_name}%{request_uri} [R,l]

These two sentences are what to do, not afraid of trouble, direct deletion is good, but also dare to add flag L ...

Landlord Hello, I saw you before about click the button to add the input control post
Some questions want to ask, trouble can leave QQ or something?
Or to pay attention to each other and send private messages?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    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.