亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

apache - Problem with RewriteRule rewriting url
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-05-16 17:00:32
0
2
714

Wordpress is installed in the blog folder in the root directory, so the address becomes http://mydomain.com/blog
Log path http://mydomain.com/blog/sample-post/
Can I use RewriteRule to change the path of wordpress to http://mydomain.com/sample-post and hide the blog?
(sample-post is not fixed, it is the name of each log, variable)
After reading htaccess for a long time, I didn’t understand how to write it.
I would also like to ask a questionRewriteRule . /index.php [L]The meaning of this sentence
Some people will have an additional index.php in the path after installing wordpress, so they need to add this sentence Remove index.php
Syntax for rewriting rules:

RewriteRule Pattern Substitution [flags]

An explanation I saw is this:

Pattern is a perl-compatible regular expression that acts on the current URL.
Substitution in the rewrite rule is the string used to replace (or replace) when the original URL matches Pattern.

Then this is not using index.php to replace any character (I am not sure what this pattern means, doesn't the '.' in the regular expression represent any single character)?

Please explain, thank you~

PHP中文網(wǎng)
PHP中文網(wǎng)

認證高級PHP講師

reply all(2)
習慣沉默

rewriterule ^/blog/([\/]+) /$1 [L]

伊謝爾倫

Solve it yourself...

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ blog/ [QSA,PT,L]

Although it can be accessed normally if you remove the blog field in the URL, if you jump through the link in the page, the URL still has its own blog. Forget it, I'll move the directory...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template