admin管理员组文章数量:1422560
Thanks for reading this!
The website I am building is used for an annual symposium that is held since 2003. All those website are still online and should remain online.
From the year 2003 till the year 2012 websites were made without the use of any cms and can be access by going to the /$year subdirectory. (see structure below)
From 2012 onwards the subdirectories are generated from within wolfCMS. From this year onwards we would like to switch to wordpress. (see structure below)
How should the htaccess file(s) be configured to make it work so that users are redirected to the wolfcms from previous editions of the symposium and to the wordpress site from this year onwards? Thanks!
Website structure:
htaccess of wolfCMS in ~/public_html/ folder:
#Setting Wolf CMS requirements
#On some server configurations you may need to comment out one or more of
#the three lines below due to server limitations.
php_flag magic_quotes_gpc off
AddDefaultCharset UTF-8
Options -Indexes +FollowSymLinks
# Setting rewrite rules
<IfModule mod_rewrite.c>
RewriteEngine On
# Set next line to your Wolf CMS root - if not in subdir, then just /
RewriteBase /
RewriteCond %{http_host} !^www.root.nl [NC]
RewriteRule ^(.*)$ /$1 [L,R=301]
# Rules to allow install sequence to test for mod_rewrite support
RewriteRule ^wolf/install/index.html$ wolf/install/index.php?rewrite=1 [L,QSA]
RewriteRule ^wolf/install/index.php$ wolf/install/index.php?rewrite=1 [L,QSA]
RewriteRule ^wolf/install/$ wolf/install/index.php?rewrite=1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
# Main URL rewriting.
RewriteRule ^(.*)$ index.php?WOLFPAGE=$1 [L,QSA]
</IfModule>
htaccess of wordpress in ~/public_html/wordpress/ folder:
RewriteEngine On
RewriteBase /wordpress/
RewriteCond %{HTTP_HOST} root.nl/wordpress/$1 [NC]
RewriteRule ^(.*)$ /$1 [R=301,L]
#RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
# RewriteRule . /wordpress/index.php [L]
Thanks for reading this!
The website I am building is used for an annual symposium that is held since 2003. All those website are still online and should remain online.
From the year 2003 till the year 2012 websites were made without the use of any cms and can be access by going to the /$year subdirectory. (see structure below)
From 2012 onwards the subdirectories are generated from within wolfCMS. From this year onwards we would like to switch to wordpress. (see structure below)
How should the htaccess file(s) be configured to make it work so that users are redirected to the wolfcms from previous editions of the symposium and to the wordpress site from this year onwards? Thanks!
Website structure:
htaccess of wolfCMS in ~/public_html/ folder:
#Setting Wolf CMS requirements
#On some server configurations you may need to comment out one or more of
#the three lines below due to server limitations.
php_flag magic_quotes_gpc off
AddDefaultCharset UTF-8
Options -Indexes +FollowSymLinks
# Setting rewrite rules
<IfModule mod_rewrite.c>
RewriteEngine On
# Set next line to your Wolf CMS root - if not in subdir, then just /
RewriteBase /
RewriteCond %{http_host} !^www.root.nl [NC]
RewriteRule ^(.*)$ http://www.root.nl/$1 [L,R=301]
# Rules to allow install sequence to test for mod_rewrite support
RewriteRule ^wolf/install/index.html$ wolf/install/index.php?rewrite=1 [L,QSA]
RewriteRule ^wolf/install/index.php$ wolf/install/index.php?rewrite=1 [L,QSA]
RewriteRule ^wolf/install/$ wolf/install/index.php?rewrite=1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
# Main URL rewriting.
RewriteRule ^(.*)$ index.php?WOLFPAGE=$1 [L,QSA]
</IfModule>
htaccess of wordpress in ~/public_html/wordpress/ folder:
RewriteEngine On
RewriteBase /wordpress/
RewriteCond %{HTTP_HOST} root.nl/wordpress/$1 [NC]
RewriteRule ^(.*)$ http://root.nl/$1 [R=301,L]
#RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
# RewriteRule . /wordpress/index.php [L]
Share
Improve this question
edited Jul 4, 2019 at 23:33
the.michiel
asked Jul 4, 2019 at 21:54
the.michielthe.michiel
134 bronze badges
6
|
Show 1 more comment
1 Answer
Reset to default 0I assume your preferred hostname is www.example
(www.root.nl
) - this needs to be consistent for both sites. (Currently your Wolf CMS seems to be favouring, whilst your WordPress directives are redirecting to example
(no www
).
This also assumes all your URLs are prefixed with a 4 digit year. ie.:
/2003
to/2012
- static site/2013
to/2018
- Wolf CMS/2019
onwards - WordPress
Try the following instead, in the .htaccess
file in the document root (public_html
directory) and remove the .htaccess
file in the /wordpress
subdirectory:
#Setting Wolf CMS requirements
#On some server configurations you may need to comment out one or more of
#the three lines below due to server limitations.
php_flag magic_quotes_gpc off
AddDefaultCharset UTF-8
Options -Indexes +FollowSymLinks
# Setting rewrite rules
RewriteEngine On
# Set next line to your Wolf CMS root - if not in subdir, then just /
# NB: You can only set the RewriteBase once in any one .htaccess file
RewriteBase /
# Canonical redirect
RewriteCond %{http_host} !^www\.example\$
RewriteRule (.*) http://www.example/$1 [R=301,L]
# Prevent further processing if request maps to an actual file
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^ - [L]
# Rules to allow install sequence to test for mod_rewrite support
# >>> ARE THESE STILL REQUIRED?
#RewriteRule ^wolf/install/index.html$ wolf/install/index.php?rewrite=1 [L,QSA]
#RewriteRule ^wolf/install/index.php$ wolf/install/index.php?rewrite=1 [L,QSA]
#RewriteRule ^wolf/install/$ wolf/install/index.php?rewrite=1 [L,QSA]
# Wolf CMS front controller
# Years 2013-2018 only - checks for this in the URL before rewriting
RewriteRule ^(201[345678]/.*) index.php?WOLFPAGE=$1 [L,QSA]
#
# When the request does not match above its falls through to WordPress...
#
RewriteRule ^wordpress/index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . /wordpress/index.php [L]
版权声明:本文标题:htaccess file for multiple CMS's (multisite wordpress + wolfcms) on same domain but different subdirectories 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745344921a2654434.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
.htaccess
file to your question. Presumably the intention is to have a single.htaccess
in thepublic_html
directory and no other.htaccess
files in subdirectories? – MrWhite Commented Jul 4, 2019 at 23:10