Domain Root - CMS Link problem
PermalinkWhen my site was simple html files, this worked and was all fine, links on my site did not show the directory my site was installed in, but now that concrete is installed, all my links look like:
http://www.mysite.com/base/index.php... where /base is the directory my site is installed in.
If I edit the /config/site.php file where DIR_REL is '/base/' and change it to '' or '/' my site does not work. I get a concrete5 formatted page that says "page not found".
I would really like to not have the install folder show in my links. My hosts forum users say this is not an .htaccess or apache problem but is an application problem.
How do I fix this?
http://www.mydomain.com
http://www.mydomain.com/about
http://www.mydomain.com/contact
Here is my / .htaccess file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteCond %{REQUEST_URI} !^/base/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /base/$1
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteRule ^(/)?$ base/index.php [L]
This redirect/rewrite is working just fine.
The problem is that C5 only works with the following line in /base/config/site.php:
define('DIR_REL', '/base');
This makes all my links look like:
www.www.mydomain.com/base/index.php...
www.www.mydomain.com/base/about...
www.www.mydomain.com/base/contact...
Of course they all work just fine and so does manually typing:
http://www.mydomain.com/about
but I should and really want to be able to hide the /base/ from the links so it's transparent.
I don't have this problem with drupal, wordpress, joomla, etc. It's an application problem, not an .htaccess problem.
Basically I think in laymans terms I need to be able to tell C5 not to incluyde the installed directory in the links and let my .htaccess rewrite do the rest.
Any suggestions?
to
RewriteRule ^(.*)$ /base/index.php/$1
and set
define('DIR_REL', '')
look into how the css is included, try editing on the fly on firefox and firebug.
if i remember correctly there is a way to add an include path to the apache, maybe can be done in htaccess as well.. and then you just need to call the css file directly without any path
RewriteEngine on # Change yourdomain.com to be your main domain. RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$ # Change 'subfolder' to be the folder you will use for your main domain. RewriteCond %{REQUEST_URI} !^/subfolder/ # Don't change this line. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Change 'subfolder' to be the folder you will use for your main domain. RewriteRule ^(.*)$ /subfolder/$1 # Change yourdomain.com to be your main domain again. # Change 'subfolder' to be the folder you will use for your main domain # followed by / then the main file for your site, index.php, index.html, etc. RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$ RewriteRule ^(/)?$ subfolder/index.php [L]
To correct this, change the last line by adding a "/$1" like so:
RewriteRule ^(/)?$ subfolder/index.php/$1 [L]
Hope this helps.
(for some reason the original htaccess code marquezstl used for his site didn't work for mine, but adjusting the last line in the code I had previously used did work.)
I then changed the define('DIR_REL','/base'); in config/site.php where "base" is the folder my site resides in.
wooohooo!
I have the same problem.
My .htaccess
RewriteCond %{HTTP_HOST} ^around.ch$ [OR]
RewriteCond %{HTTP_HOST} ^www.around.ch$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /around/$1 [PT,L,QSA]
Redirect my URLhttp://www.around.ch to the subfolder /around.
Now when i open a C5 Site the URL look like this:http://www.around.ch/around/about
I tryed to change the define('DIR_REL', '/around'); but it doesn't work.
I tryed the example above but it doesn't work :-|
Can someone help me? Thank you.
marius
In this case you have to set RewriteBase to /around
Or just use the .htaccess file content which you get when you activated the pretty urls in the sitewide settings
yes C5 is in a subdirectory.
Doesn't work with the .htaccess from the pretty urls.
The URLhttp://www.around.ch/about/ works but all links are:
http://www.around.ch/around/about/...
When i edit the site.php
define('DIR_REL', '/around'); to
define('DIR_REL', '');
An C5 error site appears
strange.
gruess us Lozern
http://www.around.ch/ -> doesn't work
http://www.around.ch/about -> works
I have searched in url_check.php, dispatcher.php, base.php? I would to change it to an other subsite.
Thanks for any help
Concrete is installed in the directory "Concrete":
anthonygarritano.com/Concrete
My site works, all URLs work. But they all reference /Concrete:
anthonygarritano.com/Concrete/about
anthonygarritano.com/Concrete/contact
Also, manually typing without /Concrete works:
anthonygarritano.com/contact
anthonygarritano.com/about
I have no idea how to get rid of /Concrete. Here is my .htaccess file:
Options -Indexes Options +ExecCGI AddHandler fastcgi-script fcg fcgi fpl AddHandler php5-fastcgi .php Action php5-fastcgi /cgi-bin/dispatch.fcgi # Turn on rewrites. Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^(http://)?anthonygarritano.com$ RewriteCond %{REQUEST_URI} !^/Concrete/$1 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /Concrete/$1 RewriteCond %{HTTP_HOST} ^(http://)?anthonygarritano.com$ RewriteRule ^(/)?$ Concrete/index.php/$1 [L]
I posted the whole .htaccess for kicks, but obviously the important stuff is where RewriteEngine on is.
ANY help, tips, advice, or links are appreciated. I'm a n00b, so play nice and over explain things please (plus, posterity will appreciate this ;)!
Concrete is installed in the directory "Concrete":
anthonygarritano.com/Concrete
My site works, all URLs work. But they all reference /Concrete:
anthonygarritano.com/Concrete/about
anthonygarritano.com/Concrete/contact
Also, manually typing without /Concrete works:
anthonygarritano.com/contact
anthonygarritano.com/about
I have no idea how to get rid of /Concrete. Here is my .htaccess file:
Options -Indexes Options +ExecCGI AddHandler fastcgi-script fcg fcgi fpl AddHandler php5-fastcgi .php Action php5-fastcgi /cgi-bin/dispatch.fcgi # Turn on rewrites. Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^(http://)?anthonygarritano.com$ RewriteCond %{REQUEST_URI} !^/Concrete/$1 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /Concrete/$1 RewriteCond %{HTTP_HOST} ^(http://)?anthonygarritano.com$ RewriteRule ^(/)?$ Concrete/index.php/$1 [L]
I posted the whole .htaccess for kicks, but obviously the important stuff is where RewriteEngine is.
ANY help, tips, advice, or links are appreciated. I'm a n00b, so play nice and over explain things please (plus, posterity will appreciate this ;)!
All in all, it's too much hassle to figure out where the problem is. Put your site back to the root domain.
It's on the bug list:
http://www.concrete5.org/community/bugs/domain_redirect_to_subfolde...
sorry greez
marius
The root index.htm file is in the home directory called 'www'.
So I want to cloak the directory 'concrete' but want to route to the index.php in this directory.
How would you then set the code?
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?yourdomain.com$
RewriteCond %{REQUEST_URI} !^/base/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /base/index.php/$1
RewriteCond %{HTTP_HOST} ^(www.)?yourdomain.com$
RewriteRule ^(/)?$ yourdomain.com/index.php/$1 [L]
where obviously 'yourdomain.com' is your domain and 'base' is the subfolder where your c5 site is installed.
Thanks everyone for posting to this thread. There's no way I could have made this work without everybody's input.
Its hopefully a snap and just an adjustment to the concrete5/config/site.php file...
*** UDPDATE ***
Easily moved to root, changed one line of code, URLS look fantastic on Godaddy.
-Steve
I have setup Concrete5 in the subfolder /cms. In /cms/config/site.php I do have
define('DIR_REL', '');
In the root I do have /.htaccess also mentioned earlier in this forum:
# Copy and paste the following code into the .htaccess file # in the public_html folder of your hosting account # make the changes to the file according to the instructions. # Do not change this line - RewriteEngine on RewriteEngine on # Change yourdomain.com to be your main domain. #RewriteCond %{HTTP_HOST} ^(www.)?yourdomain.com$ # Change 'subfolder' to be the folder you will use for your main domain. RewriteCond %{REQUEST_URI} !^/cms/ # Don't change this line. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Change 'subfolder' to be the folder you will use for your main domain. RewriteRule ^(.*)$ /cms/$1 # Change yourdomain.com to be your main domain again.
Ensure the last slash behind index.php is there! By the way, this forum might not show all lines, so press 'view entirely code block'.
So far I got pages working likehttp://www.yourdomain.com/about however still the home page reported "Page Not Found,No page could be found at this address".
To correct this behaviour, edit the concrete/libraries/request.php and change this around line 77:
if (!$path) { $path = Request::parsePathFromRequest('SCRIPT_NAME'); }
into
if ($path === false) { $path = Request::parsePathFromRequest('SCRIPT_NAME'); }
The root cause is that the PATH_INFO already nicely found the correct path, however the $path returned is empty '' and in php you should then explicity test for false. So might be reported as a bug?
To enable pretty URL I have created /cms/.htaccess with the following content:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /cms/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule>
Then I made sure not to have a /index.php in the root! When you do so it might not work for the edit mode! Concrete5 loads the menu bar by something like:
http://www.yourdomain.com/index.php/tools/required/page_controls_me...
So if the root /index.php is existing it will not rewrite the url to /cms/index.php (due to the line RewriteCond %{REQUEST_FILENAME} !-f)
I just got working properly and so far I didn't see sideeffects
With my above mentioned changes I was able to edit pages when the URL contains friendly URL's likehttp://www.yourdomain.com/about however it failed on direct pages like when you visit you page via the dashboard -> site manager. It tries to openwww.www.yourdomain.com/index.php?cID=66... and will get display the Page Not Found message.
To also correct this issue I noticed that also PATH_INFO will not be available and returns false on
$path = Request::parsePathFromRequest('PATH_INFO');
And then it will call
$path = Request::parsePathFromRequest(SCRIPT_NAME');
To prevent SCRIPT_NAME from doing this I just disabled it.
In my post above I mentioned this code:
if (!$path) { $path = Request::parsePathFromRequest('SCRIPT_NAME'); }
Now replace this part into:
if ($path === false) { $path = ""; }
Be aware that this is only properly working when the site will be or will act like it's in the root. So together with the root /.htaccess.
http://www.concrete5.org/index.php?cID=98018...
or just be happy with site.com/base