buy tadalafil

Archive for the ‘.htaccess’ Category

cgi_bin shows the internal server error

Sunday, March 21st, 2010

Error:   500 internal server error is shown when access URL

http://domain.com/cgi-bin/index.php

Solution : Add the following Handler in httpd.conf file or .htaccess file.

AddHandler application/x-httpd-php .php

Done 

Remove extensions from url

Saturday, March 20th, 2010

How to remove the  .php extension from the URL  ?

Ans : Add the following code in .htaccess file

======================

Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]

======================

How to remove the  .html extension from the URL  ?

Ans : Add the following code in .htaccess file

======================

Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.html [NC,L]

======================

.htaccess Generation Issues in wordpress

Thursday, February 18th, 2010

Fixing .htaccess Generation Issues in wordpress

If your installation of WordPress does not generate a .htaccess file or if it does not write the new rules onto your existing .htaccess file then there are a couple reasons that could be causing this. Work step by step and continue to the next step only if the previous step does not work.

  1. Change File Permissions: You must chmod the .htaccess file to 666 to edit it with the WordPress template editor, but this is not recommended, since if you do that, any user of your blog, who can edit templates will be able to edit it. You can change the permissions to 660 to make it server-writable, which again will have the same limitation.

  2. Server Blockage: Your host might have blocked the SERVER_SOFTWARE variable and this will cause WordPress’ .htaccess generation to fail. If you are sure that your server is running Apache, you can force WordPress to believe that your server is running Apache by changing your wp-includes/vars.php file. Follow the steps below to implement these changes.

    • Open the wp-includes/vars.php file using the built in file editor in your WordPress Admin panel. To navigate to this panel, login to WordPress, click on “Manage”, then on “Files”, scroll to the bottom and type in wp-includes/vars.php into the text box under the “Other Files” title. Look for

      $is_apache = strstr($_SERVER['SERVER_SOFTWARE'], ‘Apache’) ? 1 : 0;

      and replace it with

      // $is_apache = strstr($_SERVER['SERVER_SOFTWARE'], ‘Apache’) ? 1 : 0;

    • Add a new line under

      // $is_apache = strstr($_SERVER['SERVER_SOFTWARE'], ‘Apache’) ? 1 : 0;

      and type in

      $is_apache = 1;

    Done

 

Redirect domain to .cgi file

Wednesday, February 17th, 2010

If you want to redirect your domain

http://domain.co.uk

to

http://domain.co.uk/cgi-bin/test/subdirectory/test.cgi file

then add the following rewrite rule in .htaccess file

====================

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.co\.uk$ [NC]
RewriteRule ^/?$ "http\:\/\/www\.domain\.co\.uk\/cgi-bin\/test\/subdirectory\/test\.cgi$1" [R=301,L]

====================

Or

====================

http://domain.com

to

http://domain.com/cgi-bin/subdirectory/test.cgi

then add the following rewrite rule in .htaccess file

====================

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^/?$ "http\:\/\/domain\.com\/cgi-bin\/subdirectory\/test\.cgi" [R=301,L]

====================

Done

CodeIgniter redirection problem

Tuesday, February 9th, 2010
If CodeIgniter is installed on the linux server and the .htaccess file is correct but your domain is not working properly then you need to set the  “uri_protocol" in the "system/application/config/config.php” file is as follows.
$config['uri_protocol']    = "REQUEST_URI";

Redirect one page to another page by using .htaccess

Wednesday, December 23rd, 2009

Add the following rule in .htaccess file

1) If you want to redirect one page to another page, add the following code to the file, on a single line.

redirect 301 /old-file-name.htm   http://www.domain.com/new-file-name.htm

Create your own Apache Rewrite Log file

Friday, December 11th, 2009

How to Create your own Apache Rewrite Log file ?

If your account is hosted on suexec server then you need to add this code in http.conf file otherwise you can enable it by using .htaccess file.

By using  http.conf file

You need to
=============================
# Roll your own Rewrite log
# Log details via scale of 1 to 9
# 1 = few details, 5 = enough details, 9 = too much detail

RewriteEngine On
RewriteLog “/home/username/public_html/rewrite.log”
RewriteLogLevel 5
=============================

By using  .htaccess file

============================
# Roll your own Rewrite log
# Log details via scale of 1 to 9
# 1 = few details, 5 = enough details, 9 = too much detail
RewriteEngine On
RewriteLog “/home/username/public_html/rewrite.log”
RewriteLogLevel 5
=============================

Note : Replace the absolute path for rewrite.log file.

How to make root domain .htaccess not affect to addon domain

Friday, December 11th, 2009

Some time the root domain .htaccess file rule affect to addon domains. So you can not access your addon domain properly. If you want to disable this rule for the addon domain then you need to add the following rule in the root domain .htaccess file.

RewriteCond %{HTTP_HOST} ^(www\.)?addon_domain\.com
Rewriterule .* - [L]

for example addon domain is bestdesigns.co.in then rule is

RewriteCond %{HTTP_HOST} ^(www\.)?bestdesigns\.co.in
Rewriterule .* - [L]

Note : Where addon_domain should be replaced by the actual domain name, and I’m assuming that both addon_domain.com and www.addon_domain.com exist and resolve to your server.

Client denied by server configuration

Monday, December 7th, 2009

Client denied by server configuration :

Error : tail -f /usr/local/apache/logs/error_log | grep username

[Sun Dec 07 14:04:38 2008] [error] [client 203.193.165.98] client denied by server configuration: /home/username/public_html/catalog/admin/index.php

Solution:

If you get above error then you need to check .htaccess file under respective directory(here catalog/admin) and there you need to comment the rule “Deny from all”
Like this:

<Files *.php>
Order Deny,Allow
#Deny from all
</Files>

done

How to enable php setting for all Directories

Wednesday, December 2nd, 2009

If you want enable some php related setting by using php.ini file and it reflect to all  other directories which is under your account. Then follow the steps..

First create php.ini file under the document root of your domain and change or add the default setting which you want or which is required for your domain.

for example :

allow_url_fopen = On
allow_url_include = On

then you need to add the following code in your .htaccess file. So you dont need to copy the php.ini file in each directories for chnages to reflect.

SetEnv PHPRC “/home/username/public_html”


Note: Please replace user name is equal to original domain username.