Cchost/admin/apache/config

From Creative Commons
Jump to: navigation, search

Go back to ccHost Administrators' Documentation

Enabling 'Pretty URLs'

As of ccHost 4.0: if you are installing ccHost into a clean directory on your web server without any previous ReWrite rules in your .htaccess file, then the installer will attempt to do what follows below automatically.

All ccHost commands and URLs based on query strings:

http://your_install_root/index.php?ccm=/media/people/victor

That same URL can be made 'pretty' on Apache installations so that it looks more like:

http://your_install_root/media/people/victor

Here is the block of code in your .htaccess file setting the rewrite rules to get pretty urls:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?ccm=/$1 [L,QSA]

If you installed to a directory below the site's root make sure to specify that in the RewriteBase directive.

For perfomance reasons (and if you are given access) you should put those directives into an Apache virtual host block in the .conf file for your server:

<VirtualHost *:80>
ServerName ccmixter.localhost
ServerPath /ccmixter
#DocumentRoot /var/www/localhost/htdocs/cchost 
DocumentRoot /home/rejon/Documents/freelance/creativecommons/src/ccmixter

<Directory "/home/rejon/Documents/freelance/creativecommons/src/ccmixter">
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?ccm=/$1 [L,QSA]
</Directory>
</VirtualHost>

More .htaccess file settings

Put the following into a file named '.htaccess' in your root directory of a ccHost setup if you can't set your php.ini settings for your hosting setup. These settings should work, but should be tested first. They correct many memory problems people have with ccHost.

# php configs http://www.php.net/manual/en/ini.core.php#ini.memory-limit
# http://www.php.net/manual/en/ini.php#ini.list

php_value max_input_time 200
php_value max_execution_time 200
php_value memory_limit 20M
php_value upload_max_filesize 20M
# next line fixes noncompliant & used in php
php_value arg_separator.output &
php_flag session.use_trans_sid off
# turns off annoying autoquotes
php_flag magic_quotes_gpc off

Options +MultiViews

# Stop morons that are hammer your site
# Open Clip Art Library had someone DDoS'ing our site
<Limit GET>
 order deny,allow
 deny from 59.116.0.0/16
</Limit>