My blog and geoserver Chinese community has been in the same virtual host, has been done a jump, www. your domain name. com access to the words jump to http://www. Your domain name, com/wordpress, opengeo.cn domain name to access the word jump to Http://opengeo.cn/dz
Yesterday found a solution to solve, do not jump, www. your domain name. com directly access to the content of WordPress below, opengeo.cn direct access to the content of DZ below, do not have the tape directory.
Apache+php hosts usually solve two solutions to this problem, one is the use of Apache VirtualHost, one is the use of Apache htaccess. Million network of virtual host does not support the former one, had to use htaccess.
I'll just post the code directly below.
code is as follows |
copy code |
# opens Rewriteengine mode Rewriteengine on . Rewritecond%{http_host} ^ (www.)? opengeo.cn$ Rewritecond%{request_uri}!^/dz/ Rewritecond%{request_filename}!-f Rewritecond%{REQUEST_FI Lename}!-d Rewriterule ^ (. *) $/dz/$1 Rewritecond%{http_host} ^ (www.)? opengeo.cn$ Rewriterule ^ (/) $ dz/index.php [L] Rewritecond%{http_host} ^ (www.)? Your domain name. (COM|CN) $ Rewritecond%{request_uri}!^/wordpress/ Rewritecond%{request_filename}!-f RewriteCond%{REQUE St_filename}!-d Rewriterule ^ (. *) $/wordpress/$1 Rewritecond%{http_host} ^ (www.)? Your domain name. (COM|CN) $ Rewriterule ^ (/) $ wordpress/index.php [L] |
Make a simple explanation for the instructions above:
The Rewritecond directive defines the conditions under which a rule takes effect, and it can have one or more rewritecond instructions before a rewriterule instruction indicates the conditions that must be met to perform the rewriterule.
Rewriterule doesn't explain, it's a specific rule.
. htaccess file Contents
Rewriteengine on
# change your domain name. xxx to the domain name you want to bind to.
Rewritecond%{http_host} ^ (www.)? Your domain name. xxx$
# Change the subfolder to the directory you want to bind to.
Rewritecond%{request_uri}!^/subfolder/
# don't change the following two lines.
Rewritecond%{request_filename}!-f
Rewritecond%{request_filename}!-d
# change Dev to the directory to bind to.
Rewriterule ^ (. *) $/dev/$1
# change your domain name. xxx to the domain name you want to bind to
# change Dev to the directory to bind to.
# dev/behind is the first document index.php, index.html
Rewritecond%{http_host} ^ (www.)? Your domain name. xxx$
Rewriterule ^ (/) $ wordpress/index.php [L]
Note that Windows cannot create htaccess files directly because Windows does not support files without a primary filename, and we can create. htaccess files as follows
Method 1. Start-run-type cmd, open cmd window
At this point the cmd window path is c:/documents and settings/username>
Type the following (excluding information in parentheses):
Copy con. htaccess (carriage return)
(Press Ctrl+z carriage return)
The screen prompts are as follows:
C:/Documents and Settings/admin>copy con htaccess.
^z
1 files have been copied.
At this point, back to the desktop, double-click My Computer to enter c:/documents and Settings/username
You can see the file you want ". htaccess"