04-14-2023, 10:11 PM
Question:
I am trying to rewrite the URLs from index.php?page=xxx&id=123 to something more cleaner such as /home/123/ - however I cannot get the .htaccess to load, despite it being enabled in Ubuntu 8.10 with latest apache php etc. and have read that you can do it using Custom HTTP in the EHCP panel, I was wondering if you can provide an example of how to do this with the above scenario?
Answer:
Follow these steps:
1- enable mod_rewrite by: ln -s /etc/apache2/mods-enabled/rewrite.load /etc/apache2/mods-available/rewrite.load
in linux console,
2- replace your apachetemplate file in ehcp dir with following:
<code>
#____________start of {domainname}__paneluser:{panelusername}_reseller:{reseller}_id:{id}____________
# explanation {aciklama}
# Namevirtualhost *:80
# <VirtualHost *:80>
<VirtualHost *>
ServerName {domainname}
ServerAlias www.{domainname}
UseCanonicalName Off
DocumentRoot {homedir}/httpdocs
# this combined log format is understandable by webalizer... some other formats are not recognised by webalizer.. thats why, specified here explicitly..
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
CustomLog {homedir}/logs/access_log combined
CustomLog /var/log/apache_common_access_log vhost_combined
php_admin_value open_basedir {homedir}
php_admin_value upload_tmp_dir {homedir}/phptmpdir
AccessFileName .htaccess
<Directory {homedir}/httpdocs>
AllowOverride All
</Directory>
{customhttp}
</VirtualHost>
<VirtualHost *>
ServerAlias webmail.{domainname}
DocumentRoot /var/www/vhosts/ehcp/webmail
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
CustomLog {homedir}/logs/access_log combined
CustomLog /var/log/apache_common_access_log vhost_combined
php_admin_value open_basedir /var/www/vhosts/ehcp/webmail
php_admin_value upload_tmp_dir /var/www/vhosts/ehcp/webmail/data
</VirtualHost>
#____________end of {domainname}__paneluser:{panelusername}_reseller:{reseller}_id:{id}____________
</code>
3- # what we added in previous step is actually (summary here):
<code>
AccessFileName .htaccess
<Directory {homedir}/httpdocs>
AllowOverride All
</Directory>
</code>
4- on ehcp, options, click on sync domains,
this way, your .htacces will be activated.
To ensure that it is activated for example,
write in it asdfasdfasdfasdfasdf
and navigate to your page,
if you see http error, then .htaccess is activated.
if you see normal webpage, then .htaccess is not enabled...
(These steps will be done/enabled by default in newer versions than 0.29.05)
Restored from old drupal forum, for user uid:1 username:ehcpdeveloper
You may reset your password to access your new account here.
I am trying to rewrite the URLs from index.php?page=xxx&id=123 to something more cleaner such as /home/123/ - however I cannot get the .htaccess to load, despite it being enabled in Ubuntu 8.10 with latest apache php etc. and have read that you can do it using Custom HTTP in the EHCP panel, I was wondering if you can provide an example of how to do this with the above scenario?
Answer:
Follow these steps:
1- enable mod_rewrite by: ln -s /etc/apache2/mods-enabled/rewrite.load /etc/apache2/mods-available/rewrite.load
in linux console,
2- replace your apachetemplate file in ehcp dir with following:
<code>
#____________start of {domainname}__paneluser:{panelusername}_reseller:{reseller}_id:{id}____________
# explanation {aciklama}
# Namevirtualhost *:80
# <VirtualHost *:80>
<VirtualHost *>
ServerName {domainname}
ServerAlias www.{domainname}
UseCanonicalName Off
DocumentRoot {homedir}/httpdocs
# this combined log format is understandable by webalizer... some other formats are not recognised by webalizer.. thats why, specified here explicitly..
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
CustomLog {homedir}/logs/access_log combined
CustomLog /var/log/apache_common_access_log vhost_combined
php_admin_value open_basedir {homedir}
php_admin_value upload_tmp_dir {homedir}/phptmpdir
AccessFileName .htaccess
<Directory {homedir}/httpdocs>
AllowOverride All
</Directory>
{customhttp}
</VirtualHost>
<VirtualHost *>
ServerAlias webmail.{domainname}
DocumentRoot /var/www/vhosts/ehcp/webmail
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
CustomLog {homedir}/logs/access_log combined
CustomLog /var/log/apache_common_access_log vhost_combined
php_admin_value open_basedir /var/www/vhosts/ehcp/webmail
php_admin_value upload_tmp_dir /var/www/vhosts/ehcp/webmail/data
</VirtualHost>
#____________end of {domainname}__paneluser:{panelusername}_reseller:{reseller}_id:{id}____________
</code>
3- # what we added in previous step is actually (summary here):
<code>
AccessFileName .htaccess
<Directory {homedir}/httpdocs>
AllowOverride All
</Directory>
</code>
4- on ehcp, options, click on sync domains,
this way, your .htacces will be activated.
To ensure that it is activated for example,
write in it asdfasdfasdfasdfasdf
and navigate to your page,
if you see http error, then .htaccess is activated.
if you see normal webpage, then .htaccess is not enabled...
(These steps will be done/enabled by default in newer versions than 0.29.05)
Restored from old drupal forum, for user uid:1 username:ehcpdeveloper
You may reset your password to access your new account here.