21487 Posts in 5783 Topics by 2621 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 633 Views |
-
[solved] modifying .htaccess for site update

24 March 2011 at 11:33pm Last edited: 24 March 2011 11:49pm
hi,
right now i have a silverstripe installation in a subfolder of root: /cms
i use two .htaccess files, one in root, the other one in /cms - so the user doesn't know he's actually in /cmsnow i would start working on a update and would like to install a new version of ss to another folder: /cms_2.4
so i would like the visitors still see my old site, but my ip should redirect to the new one in /cms_2.4
my .htaccess in webroot is:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cms/
RewriteCond %{REQUEST_URI} !^/cms/
RewriteRule ^(.*)$ /cms/$1
</IfModule>i would like to have something like that:
if !myip
goto /cms
else
goto /cms_2.4how are the new redirect rules?
thanks
-
Re: [solved] modifying .htaccess for site update

25 March 2011 at 12:30am
right here...
http://www.silverstripe.org/general-questions/show/14725 -
Re: [solved] modifying .htaccess for site update

25 March 2011 at 1:41am Last edited: 25 March 2011 2:55am
right, i also found this thread...
but it doesn't tell me where to copy the lines of code. and: do i have to modify the existing .htaccess or is it enough to add the mentioned code.this only applys to when i want to redirect to a file.
but i want to switch the directory. -
Re: [solved] modifying .htaccess for site update

25 March 2011 at 4:19am
sorry about that, I don't know, but I'd read this http://httpd.apache.org/docs/2.0/misc/rewriteguide.html if I needed to learn more about it
-
Re: [solved] modifying .htaccess for site update

25 March 2011 at 5:36am Last edited: 25 March 2011 7:22am
just to recapitulate:
i want different silverstripe installation in the same webroot, in separate subfolders like: httpdocs/cms_2.3 or httpdocs/cms_2.4
i want urls, that look like: mydomain.com/page1 and not mydomain.com/cms_2.3/page1
i want to work on one silverstripe installation, cms_2.4, but all users be redirected to cms_2.3when finished working on cms_2.4 i want to switch to cms_2.4 without anyone notice, of course.
so, i went and installed my silverstripe versions in the appropriate folders.
then, i changed /cms_2.3/.htaccess and /cms_2.4/.htaccessfrom (example of /cms_2.3/.htaccess):
RewriteBase /cms_2.3
to:RewriteBase /
then i added a .htaccess file to webroot:
<IfModule mod_rewrite.c>
RewriteEngine On
#change 127.0.0.1 to your ip
RewriteCond %{REMOTE_HOST} ^127\.0\.0\.1$
RewriteRule ^(.*)$ /cms_2.4/$1 [L]
RewriteRule ^(.*)$ /cms_2.3/$1 [L]
</IfModule>then i had to modify _config.php in yourSite folder. just add this line of code to the end:
Director::setBaseURL("/");
now, everyone not coming from 127.0.0.1 is redirected to cms_2.3, and i can work on cms_2.4. when finished, i just change
toRewriteRule ^(.*)$ /cms_2.3/$1 [L]
and start workin on cms_2.5RewriteRule ^(.*)$ /cms_2.4/$1 [L]
actually, i only tested it on my wamp server installation. when i come home, i will test it on a live site.
| 633 Views | ||
|
Page:
1
|
Go to Top |


