Hi All,
We have a CMSMS install on our site root. Then a wordpress install in a subdir (/wpress/). I had this setup with CMSMS on the main domain and wordpress in a subdomain. Happy days.
I have now been asked to move the blog into our main domain. Which I have tested and doesn't work when you have pretty urls (mod_rewrite) enabled on cmsms and permalinks on wordpress.
Has anyone got around this or know how to restrict the cmsms htaccess rules?
mod_rewrite & wordpress
-
- Forum Members
- Posts: 85
- Joined: Wed Jun 20, 2007 5:40 pm
Re: mod_rewrite & wordpress
I have done some more testing and I am sure it was some rules in our htaccess from the previous install messing it around...
Basically I removed the first set of rules from the WP htaccess, I am assuming they were as the blog was installed in the root (of a subdomain)
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# BEGIN WordPress
RewriteEngine On
RewriteBase /motorbike-blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /motorbike-blog/index.php [L]
# END WordPress
Basically I removed the first set of rules from the WP htaccess, I am assuming they were as the blog was installed in the root (of a subdomain)
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# BEGIN WordPress
RewriteEngine On
RewriteBase /motorbike-blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /motorbike-blog/index.php [L]
# END WordPress
Re: mod_rewrite & wordpress
Hello,
you want to host two web services (URL mapped content) on the same host. OK.
If they are not put in two separate subdirs (URL prefix), how do you know an incoming URL belongs to soft1 or soft2 ?
This is not CMSms specific.
Pierre M.
you want to host two web services (URL mapped content) on the same host. OK.
If they are not put in two separate subdirs (URL prefix), how do you know an incoming URL belongs to soft1 or soft2 ?
This is not CMSms specific.
Pierre M.
Re: mod_rewrite & wordpress
Just an idea: you could specially exclude a subdirectory from URL rewriting and implement folder specific rewrite rules. Or you resolve the wordpress URLs first and then perform (if applicable) the CMSMS rewriting:
e.g. (dirty):
You can chain several of these statements
You can do a lot with rewriting, but it takes time to understand it (it's really worth digging a little into the matter).
But be carefull, depending on your setting, wordpress is keen to overwrite your htaccess when you switch the rules with the admin panel.
As suggested, when it is in a subdirectory, remove it from CMSMS URL rewriting and have anotehr htaccess in the wordpress folder controlling the wordpress rewriting.
As I said, just a brief idea, let me know if that helped you (or am I totally off track?).
Best
Nils
e.g. (dirty):
Code: Select all
RewriteCond %{REQUEST_URI} ^/somedir/somedir2
this will limit the application of the following rules to the stated directory (may be a "fake" directory)
RewriteCond %{REQUEST_URI} !^/somedir/somedir2
this will exclude the application of the following rules to the stated directory
Code: Select all
RewriteCond %{REQUEST_URI} ^/somedir$ [OR]
RewriteCond %{REQUEST_URI} ^/somedir2$ [OR]
RewriteCond %{REQUEST_URI} ^/someotherdir$
But be carefull, depending on your setting, wordpress is keen to overwrite your htaccess when you switch the rules with the admin panel.
As suggested, when it is in a subdirectory, remove it from CMSMS URL rewriting and have anotehr htaccess in the wordpress folder controlling the wordpress rewriting.
Code: Select all
RewriteBase /
RewriteCond %{REQUEST_URI} !^/wordpress
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ cmsms/index.php?page=$1 [QSA,L]
Best
Nils
Re: mod_rewrite & wordpress
I agree with Nils : there could be only one /blog subdir for WordPress (living there may be with its own .htaccess) and CMSms installed in the rootdir with a top rewriting condition being "if the request does NOT begin with /blog".
Again, this is not CMSms specific : there could be also SMF under /forum, Magento under /shop and another CMS (or static site) in the root.
Pierre M.
Again, this is not CMSms specific : there could be also SMF under /forum, Magento under /shop and another CMS (or static site) in the root.
Pierre M.