I am trying to write redirects to have old urls go to new urls.
The site I am currently working on is at
http://209.97.208.212
I have a redirect set up
RewriteRule ^education-center.htm$ financial-fitness-center [R=301,L]
I would expect http://209.97.208.212/education-center.htm
to redirect as
http://209.97.208.212/financial-fitness-center
but instead it redirects as
http://209.97.208.212/home/consumer/pub ... ess-center
config.php has:
$config['root_path'] = '/home/consumer/public_html/';
which matches the extra part I don't want in my url, so how do I stop this from displaying in the url?
url rewrites display root_path
Re: url rewrites display root_path
Read the three lines above that line in config.php

And then change it to the right url, in this case: http://209.97.208.212#Document root as seen from the webserver. No slash at the end
#If page is requested with https use https as root url
#e.g. http://blah.com
Make your community a better place!
Re: url rewrites display root_path
Thank you.
Did you mean change
$config['root_path'] = '/home/consumer/public_html/';
to
$config['root_path'] = 'http://209.97.208.212';
or to
$config['root_path'] = '/home/consumer/public_html';
without trailing slash, and
http://209.97.208.212
somewhere else?
Did you mean change
$config['root_path'] = '/home/consumer/public_html/';
to
$config['root_path'] = 'http://209.97.208.212';
or to
$config['root_path'] = '/home/consumer/public_html';
without trailing slash, and
http://209.97.208.212
somewhere else?
Re: url rewrites display root_path
Jesse wrote: $config['root_path'] = 'http://209.97.208.212';

Make your community a better place!
Re: url rewrites display root_path
Sorry, that seems to be incorrect.
$config['root_url'] = 'http://209.97.208.212';
$config['root_path'] = '/home/consumer/public_html/';
setting
$config['root_path'] = 'http://209.97.208.212';
produces this error:
Fatal error: Class 'CmsRoute' not found in /home/consumer/public_html/lib/classes/class.contentoperations.inc.php on line 1077
$config['root_url'] = 'http://209.97.208.212';
$config['root_path'] = '/home/consumer/public_html/';
setting
$config['root_path'] = 'http://209.97.208.212';
produces this error:
Fatal error: Class 'CmsRoute' not found in /home/consumer/public_html/lib/classes/class.contentoperations.inc.php on line 1077
Re: url rewrites display root_path
Jesse,
I'm very sorry, I have not read your question right
I thaught you were talking about the root_url.
Reading is difficult sometimes
What you could do, is run the install script again (making sure you untick the 2 options -content and tables- in step 5) as that is already in the existing database. Running the installer makes the system generate the new config.php with all correct paths.
I'm very sorry, I have not read your question right
I thaught you were talking about the root_url.
Reading is difficult sometimes

What you could do, is run the install script again (making sure you untick the 2 options -content and tables- in step 5) as that is already in the existing database. Running the installer makes the system generate the new config.php with all correct paths.
Make your community a better place!
Re: url rewrites display root_path
Hi, I did that (again) and it rewrote config.php, but that did not fix the problem. It wrote the same root_path and everything else as it did previously.
I don't believe root_path is incorrect.
I was wondering if it had something to do with virtual hosts in apache?
I have this set up as a virtual host, not in /usr/local/apache/htdocs but rather in /home/consumer/public_html
I was using the ip address temporarily for staging purposes while the production version of the site remains up at the domain name.
The plan is to eventually point the domain name at the new site once complete.
As an experiment, I tried chenging root_url from the ip to the domain name, and changing my local machine's etc/hosts file to resolve the domain to the ip.
unfortunately it did not fix the issue and still inserts the root_path into the url for rewrites.
I don't believe root_path is incorrect.
I was wondering if it had something to do with virtual hosts in apache?
I have this set up as a virtual host, not in /usr/local/apache/htdocs but rather in /home/consumer/public_html
I was using the ip address temporarily for staging purposes while the production version of the site remains up at the domain name.
The plan is to eventually point the domain name at the new site once complete.
As an experiment, I tried chenging root_url from the ip to the domain name, and changing my local machine's etc/hosts file to resolve the domain to the ip.
unfortunately it did not fix the issue and still inserts the root_path into the url for rewrites.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: url rewrites display root_path
The apache .htaccess stuff gets executed before anything in CMSMS. Therefore apache has no concept of your 'root_path' or 'root_url'.
If you are having problems with rewrite rules then the best bet (so that you don't have confusion, which is what this sounds like) is to generate a few simple .html files with the appropriate names (in a separate subdirectory) and test your .htaccess rules and make sure they are correct.
THEN put CMSMS back into the picture with the same .htaccess rules and keep an eye on your access and error log.
I've seen people have problems like this where the .htaccess file was the problem...
I've also seen where the problem is caused by some redirections that were done in the page/template (or by some module) of CMSMS. like the {redirect_url} tag etc. The system was doing what it was told, but the administrator didn't know/remember that he had placed some other redirections in there.
If you are having problems with rewrite rules then the best bet (so that you don't have confusion, which is what this sounds like) is to generate a few simple .html files with the appropriate names (in a separate subdirectory) and test your .htaccess rules and make sure they are correct.
THEN put CMSMS back into the picture with the same .htaccess rules and keep an eye on your access and error log.
I've seen people have problems like this where the .htaccess file was the problem...
I've also seen where the problem is caused by some redirections that were done in the page/template (or by some module) of CMSMS. like the {redirect_url} tag etc. The system was doing what it was told, but the administrator didn't know/remember that he had placed some other redirections in there.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: url rewrites display root_path
I have a working static file at
http://209.97.208.212/example.html
With this in the .htaccess:
RewriteRule ^test.htm$ example.html [R=301,L]
the url
http://209.97.208.212/test.htm
redirects to
http://209.97.208.212/home/consumer/pub ... ample.html
I had previously set this up (and created the redirects) on a local xampp installation where the root was /usr/local/apache/htdocs
and moved it to a remote apache server where the root is /home/consumer/public_html and that's where I started having this problem.
Not sure what to do next.
http://209.97.208.212/example.html
With this in the .htaccess:
RewriteRule ^test.htm$ example.html [R=301,L]
the url
http://209.97.208.212/test.htm
redirects to
http://209.97.208.212/home/consumer/pub ... ample.html
I had previously set this up (and created the redirects) on a local xampp installation where the root was /usr/local/apache/htdocs
and moved it to a remote apache server where the root is /home/consumer/public_html and that's where I started having this problem.
Not sure what to do next.
Re: url rewrites display root_path
This should do the trick
Greetings,
Manuel

Code: Select all
RewriteRule ^education-center.htm$ http://209.97.208.212/financial-fitness-center [R=301,L]
Manuel
Do you like your open source cms? Buy from the CMSMS partners || Donate