Htaccess pseudo-static rules

Source: Internet
Author: User
Help htaccess pseudo-static rules, convert IIS httpd. ini pseudo-static rules test website: www. fphs5.comdate & nbsp; its dynamic parameters :? Date2014-1-10 I want to use pseudo static implementation to directly display the address in date format such as: 2014110 & nbsp! Htaccess pseudo-static rules: rewrite & nbs help htaccess pseudo-static rules
Turn to htaccess pseudo-static rules to convert IIS's httpd. ini pseudo-static rules
Test site: http://www.fphs5.com/date/ it is followed by dynamic parameters :? Date = 2014-1-10
I want to use pseudo-static to display the address in the format of date, such as: 2014110!
The pseudo-static htaccess rules are as follows:
rewrite ^/date/$ index_date.php last;
rewrite ^/date/(.*)/$ index_date.php?date=$1 last;

I would like to ask you how to convert it, or you can write a paragraph for help! Thank you !!!

Share: More


------ Solution --------------------
Your format conversion seems a bit problematic, such
Your format is according to your url should be
/Date/2014112 convert to index_date.php? Date = 2014-1-12

But the problem is that 2014112 can be converted to 2014-1-12 or 2014-11-2.
Therefore, there is no way to determine which one should be

If your conversion is from/date/2014-1-12 to index_date.php? Date = is relatively easy
------ Solution --------------------
Reference:
Quote: reference:

Quote: reference:

Quote: reference:

Your format conversion seems a bit problematic, such
Your format is according to your url should be
/Date/2014112 convert to index_date.php? Date = 2014-1-12

But the problem is that 2014112 can be converted to 2014-1-12 or 2014-11-2.
Therefore, there is no way to determine which one should be

If your conversion is from/date/2014-1-12 to index_date.php? Date = is relatively easy

Now is the form: http://www.fphs5.com/date? Date = 2014-1-10
I want to implement this form through IIS pseudo-static rules: http://www.fphs5.com/date/2014110

Http://www.fphs5.com/date/2014110the final scheme is based on http://www.fphs5.com/date /? Date = January, so we can't tell which of the three 2014110 digits is the month and which is the date. in February 110, the month 1 and 12 is the 12, which is the focus, so, you 'd better clearly distinguish the 2014110 value from the month and the day.

Use the expressions like 01, 02, 03... before December 10 and before December 10?


Try this

rewrite ^/date/([\d]{4})([\d]{2})([\d]{2})/$ index_date.php?date=$1-$2-$3 last;


There is no strict limit on matching of year, month, and day. it is not rigorous and should be usable.
------ Solution --------------------
If it is http://www.fphs5.com/date/20140110the most final scheme is based on http://www.fphs5.com/date /? Date = 2014-01-10
In this case, we can handle a lot of problems.

Can be used directly
^/Date /((? : 19
------ Solution --------------------
20) \ d) (0 [1-9]
------ Solution --------------------
1 [012]) (0 [1-9]
------ Solution --------------------
[12] [0-9]
------ Solution --------------------
3 [01])/$ index_date.php? Date = $1-$3-$4;

------ Solution --------------------
First, convert your date parameter to the format to ensure that the month and the day are two: date ('Y-m-D', strtotime ('2017-1-12 '));

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.