alexv55

Registered
Feb 3, 2011
1
0
51
I am posting it here after spending over a day and reading apache and docs on the web.

I am trying to test apache’s rewrite rules directive on. I have sub directory under public_html called wm, which contains test.php and a very simple .htaccess files; nothing fancy.

# start .htaccess

RewriteEngine On
RewriteRule ^wm(/)?$ test.php [NC,L]

# end .htaccess

// start test.php
<?php
echo ‘hello world’;
?>
// end test.php

I am expecting it to execute test.php and display ‘hello world’ when I type www.mydomain.co/wm. Instead, I get internet server error message. Also, when I try Business profile for mydomain.co provided by Network Solutions, I still get internal server error.

I can’t quite put my finger on what’s missing.

Alex
 

LinuxTechie

Well-Known Member
Jan 22, 2011
502
10
68
cPanel Access Level
Root Administrator
Hi Alex.

It may be an issue with permission or ownership. Please posy your apache error logs which can be found with the help of the command tail -f /usr/local/apache/logs/error_log
 

raghunath

Member
Feb 2, 2011
12
0
51
You can try this
------------------------------------------------------------
RewriteEngine On
RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^domainname.com/$ [NC,OR]
RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^www.domainname.com/$ [NC]
RewriteRule ^(.*)$ http://www.domainname.com/test.php/$1 [r=301,nc]
------------------------------------------------------------

OR
Code:
# Redirect old file path to new file path
RewriteEngine On
Redirect /olddirectory/oldfile.html http://domainame.com/newdirectory/newfile.html