Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Guide to creating seperate folders and clean URLs for your domains in CCGI space
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Guide to creating seperate folders and clean URLs ...
Guide to creating seperate folders and clean URLs for your domains in CCGI space
25-11-2007 1:26 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I came up with some .htaccess code that lets you point your domains to their own subdirectory within your CCGI space, e.g.
example.com/dir/file.php -> points to /files/home1/user/example/dir/file.php
ccgi.user.plus.com/another-file.php -> points to /files/home1/inspiration3/ccgi/another-file.php
This allows each of your websites to be unique and secure against XSS attacks. You can still link scripts between sites because only the URL is modified.
To set this up follow each step, you must have already turned on CCGI services and configured the DNS records of your new domain:
That's it! Remember to modify your scripts to use the new paths.
example.com/dir/file.php -> points to /files/home1/user/example/dir/file.php
ccgi.user.plus.com/another-file.php -> points to /files/home1/inspiration3/ccgi/another-file.php
This allows each of your websites to be unique and secure against XSS attacks. You can still link scripts between sites because only the URL is modified.
To set this up follow each step, you must have already turned on CCGI services and configured the DNS records of your new domain:
- Move all your files from your ccgi space to a subfolder called "ccgi"
- Create a new folder for your domain, i.e. if you have mysite.co.uk name the folder "mysite"
- Create a file called ".htaccess" in your top level folder
- Set the file contents to the following, replacing user with your username, folder with the name of the folder you created in step 2 and homeX with your plusnet assigned directory number:
Quote RewriteEngine On
RewriteCond %{HTTP_HOST} ccgi\.user\.plus\.com$
RewriteCond %{REQUEST_URI} ^(.+[^/])$
RewriteCond /files/homeX/user/ccgi%1 -d
RewriteRule (.+[^/])$ /$1/ [r=301,l]
RewriteCond %{HTTP_HOST} ccgi\.user\.plus\.com$
#RewriteCond %{REQUEST_URI} !^/ccgi
RewriteRule ^(.*)$ /ccgi/$1
RewriteCond %{HTTP_HOST} folder\.com$
RewriteCond %{REQUEST_URI} ^(.+[^/])$
RewriteCond /files/homeX/user/folder%1 -d
RewriteRule (.+[^/])$ /$1/ [r=301,l]
RewriteCond %{HTTP_HOST} folder\.com$
#RewriteCond %{REQUEST_URI} !^/folder
RewriteRule ^(.*)$ /folder/$1 - Uncomment the highlighted lines if you need to support physical paths - in most cases you can leave this
- Upload the .htaccess file
That's it! Remember to modify your scripts to use the new paths.
Message 1 of 5
(1,949 Views)
4 REPLIES 4
Re: Guide to creating seperate folders and clean URLs for your domains in CCGI space
26-11-2007 3:15 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Not quite sure - would it be possible to get some more explanations.
As far as I understand it:
You have your URL ccgi.username.plus.com and a domain URL mydomain.com.
You want ccgi.username.plus.com to point into a directory1 and your mydomain.com to point into a directory2.
Both URLs point to the root of ccgi (the mydomain.com with appropriate settings in the PlusNet domain tool and by then asking Customer Support to do their bits as well).
And you put a .htaccess file into ccgi root.
Do I understand this correct?
The reason I am asking, because I did search previously for a way to point URLs away from the root into directories and it works (trial and error):
Is this any different in view of security to the way you have it in .htaccess?
Question 2:
Would you know how to point into a subdirectory, e.g. directory2/subdirectory ?
As far as I understand it:
You have your URL ccgi.username.plus.com and a domain URL mydomain.com.
You want ccgi.username.plus.com to point into a directory1 and your mydomain.com to point into a directory2.
Both URLs point to the root of ccgi (the mydomain.com with appropriate settings in the PlusNet domain tool and by then asking Customer Support to do their bits as well).
And you put a .htaccess file into ccgi root.
Quote RewriteEngine On
RewriteCond %{HTTP_HOST} ccgi\.username\.plus\.com$
RewriteCond %{REQUEST_URI} ^(.+[^/])$
RewriteCond /files/homeX/username/directory1%1 -d
RewriteRule (.+[^/])$ /$1/ [r=301,l]
RewriteCond %{HTTP_HOST} ccgi\.username\.plus\.com$
RewriteCond %{REQUEST_URI} !^/ccgi
RewriteRule ^(.*)$ /directory1/$1
RewriteCond %{HTTP_HOST} mydomain\.com$
RewriteCond %{REQUEST_URI} ^(.+[^/])$
RewriteCond /files/homeX/username/directory2%1 -d
RewriteRule (.+[^/])$ /$1/ [r=301,l]
RewriteCond %{HTTP_HOST} mydomain\.com$
RewriteCond %{REQUEST_URI} !^/mydomain
RewriteRule ^(.*)$ /directory2/$1
Do I understand this correct?
The reason I am asking, because I did search previously for a way to point URLs away from the root into directories and it works (trial and error):
Quote RewriteEngine on
# mydomain.com
RewriteCond %{HTTP_HOST} ^mydomain.com$ [nc]
RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301]
# www.mydomain.com
RewriteCond %{HTTP_HOST} ^www.mydomain.com$ [nc]
RewriteRule (.*) /directory2/$1
Is this any different in view of security to the way you have it in .htaccess?
Question 2:
Would you know how to point into a subdirectory, e.g. directory2/subdirectory ?
Message 2 of 5
(380 Views)
Re: Guide to creating seperate folders and clean URLs for your domains in CCGI space
26-11-2007 4:35 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Yes you've understood correctly. You've also remembered to replace home1 in my example with whatever directory number plusnet has assigned you to (i.e. home1, home2 or home3) - I'll edit my post to mention this thanks.
My last and third from last lines of code for each section is the same as the method you're using. The middle line of code is not necessary - it's just there to support the physical site structure (i.e. to support badly coded javascripts and old links).
The first four lines of each part is needed to automatically append* a slash to directories. Without it Apache will redirect to the full path, e.g. example.com/mydir will become example.com/mydir/ instead of what would normally be example.com/example/mydir/
My last and third from last lines of code for each section is the same as the method you're using. The middle line of code is not necessary - it's just there to support the physical site structure (i.e. to support badly coded javascripts and old links).
The first four lines of each part is needed to automatically append* a slash to directories. Without it Apache will redirect to the full path, e.g. example.com/mydir will become example.com/mydir/ instead of what would normally be example.com/example/mydir/
Message 3 of 5
(381 Views)
Re: Guide to creating seperate folders and clean URLs for your domains in CCGI space
27-11-2007 10:13 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Quote from: A ...example.com/mydir will become example.com/mydir/ instead of what would normally be example.com/example/mydir/
Do I understand this correctly:
When I input into the browser
http://www.mydomain.com/subdirectory/
it will direct into
http://ccgi.username.plus.com/directory1/subdirectory
and display it as
http://www.mydomain.com/subdirectory
in the browser?
If this is the case, where in the .htaccess is the directory1->subdirectory to be put in?
Thanks
Message 4 of 5
(381 Views)
Re: Guide to creating seperate folders and clean URLs for your domains in CCGI space
30-11-2007 7:26 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
You just need to change the folder part in the code of my first post.
Quote from: ffupi If this is the case, where in the .htaccess is the directory1->subdirectory to be put in?
Message 5 of 5
(381 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Guide to creating seperate folders and clean URLs ...