enable mod_rewrite for unexperienced user

Muhammad_1

Member
Mar 20, 2011
18
0
51
Dear all
Sorry for creating this new thread while lot of thread for this topic already exit
actually i did mistake to buy unmanaged VPS while i did not know basic command to use UNIX
any way i transfer all my files from old server to new one
after changing name server my domain is ready but only home page
when i try to go any page its come 404 error and when i try to log in my wordpress dashboard its come 500 internal error
i search on google and find i need to enabled rewrite mod in my apache server
so when i search on Google how to enabled rewrite mod then i find i need to edit httpd.conf file
and when i search google how to edit httpd.conf file then i got
/etc/httpd/conf/httpd.conf
but when i type i see i dont have permission to see this file
now after surfing more then 10 hours on internet i still dont know how i can chomd this file
u think i m thick person ,never mind u can think it
but please help me
if no body then may be i will suicide
if any one help me urgent its can save my life
 
Last edited:

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
mod_rewrite is enabled by default on cPanel servers, so you should be able to run the following in root SSH to see the results:

Code:
httpd -l | grep -i rewrite
It should return the following:

Code:
# httpd -l | grep -i rewrite
  mod_rewrite.c
Did you actually switch the site to the new machine or you are using the temporary url to access it? mod_userdir which handles the temporary urls might be excluded on the machine.

If you want to see the exact cause for the error, you can also try tailing the Apache error log:

Code:
tail -f /usr/local/apache/logs/error_log
The path is /usr/local/apache/conf/httpd.conf for the Apache configuration file. If you aren't able to see the file or access it, are you logged in as the root user to the server? By root user, I mean you logged in with the username root not some other username.
 

Muhammad_1

Member
Mar 20, 2011
18
0
51
when i type httpd -l | grep -i rewrite
then its return too this one
[email protected] [~]# httpd -1 grep -i rewrite
httpd: illegal option -- 1
Usage: /usr/local/apache/bin/httpd [-D name] [-d directory] [-f file]
[-C "directive"] [-c "directive"]
[-k start|restart|graceful|graceful-stop|stop]
[-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S]
Options:
-D name : define a name for use in <IfDefine name> directives
-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile
-C "directive" : process directive before reading config files
-c "directive" : process directive after reading config files
-e level : show startup errors of level (see LogLevel)
-E file : log startup errors to file
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
-l : list compiled in modules
-L : list available configuration directives
-G : list available configuration directives after loading conf file
-t -D DUMP_VHOSTS : show parsed settings (currently only vhost settings)
-S : a synonym for -t -D DUMP_VHOSTS
-t -D DUMP_MODULES : show all loaded modules
-M : a synonym for -t -D DUMP_MODULES
-t : run syntax check for config files
-T : start without DocumentRoot(s) check
 

Muhammad_1

Member
Mar 20, 2011
18
0
51
[Thu Mar 24 01:11:02 2011] [error] [client 93.158.149.31] File does not exist: /home/pinditub/public_html/404.shtml
 

Muhammad_1

Member
Mar 20, 2011
18
0
51
Code:
[Thu Mar 24 01:13:31 2011] [error] [client 208.115.111.70] File does not exist: /home/pinditub/public_html/404.shtml
[Thu Mar 24 01:13:33 2011] [error] [client 65.52.110.80] File does not exist: /home/pinditub/public_html/2010
[Thu Mar 24 01:13:33 2011] [error] [client 65.52.110.80] File does not exist: /home/pinditub/public_html/404.shtml
[Thu Mar 24 01:13:34 2011] [error] [client 65.52.110.80] File does not exist: /home/pinditub/public_html/tag
[Thu Mar 24 01:13:34 2011] [error] [client 65.52.110.80] File does not exist: /home/pinditub/public_html/404.shtml
[Thu Mar 24 01:13:43 2011] [error] [client 66.249.72.215] SoftException in Application.cpp:256: File "/home/pinditub/public_html/wp-content/plugins/gd-star-rating/ajax.php" is writeable by group, referer: [url]http://www.pinditube.com/2011/02/news-beat-18th-february-2011/[/url]
[Thu Mar 24 01:13:43 2011] [error] [client 66.249.72.215] Premature end of script headers: ajax.php, referer: [url]http://www.pinditube.com/2011/02/news-beat-18th-february-2011/[/url]
[Thu Mar 24 01:13:43 2011] [error] [client 66.249.72.215] File does not exist: /home/pinditub/public_html/500.shtml, referer: [url]http://www.pinditube.com/2011/02/news-beat-18th-february-2011/[/url]
[Thu Mar 24 01:13:51 2011] [error] [client 93.158.149.31] File does not exist: /home/pinditub/public_html/2010
[Thu Mar 24 01:13:51 2011] [error] [client 93.158.149.31] File does not exist: /home/pinditub/public_html/404.shtml
[Thu Mar 24 01:14:01 2011] [error] [client 65.52.110.40] File does not exist: /home/pinditub/public_html/2010
[Thu Mar 24 01:14:01 2011] [error] [client 65.52.110.40] File does not exist: /home/pinditub/public_html/404.shtml
[Thu Mar 24 01:14:10 2011] [error] [client 66.249.72.215] SoftException in Application.cpp:256: File "/home/pinditub/public_html/wp-content/plugins/gd-star-rating/ajax.php" is writeable by group, referer: [url]http://www.pinditube.com/2011/03/watch-all-sexy-sixes-video-in-world-cup-2011/[/url]
[Thu Mar 24 01:14:10 2011] [error] [client 66.249.72.215] Premature end of script headers: ajax.php, referer: [url]http://www.pinditube.com/2011/03/watch-all-sexy-sixes-video-in-world-cup-2011/[/url]
[Thu Mar 24 01:14:10 2011] [error] [client 66.249.72.215] File does not exist: /home/pinditub/public_html/500.shtml, referer: [url]http://www.pinditube.com/2011/03/watch-all-sexy-sixes-video-in-world-cup-2011/[/url]
 

Muhammad_1

Member
Mar 20, 2011
18
0
51
my Dear first of all i m LOG on putty as root admin
second i witch the site to the new machine
third when i type httpd -l | grep -i rewrite
then i got follow screen

Code:
[email protected] [~]# httpd -1 | grep -i rewrite
httpd: illegal option -- 1
Usage: /usr/local/apache/bin/httpd [-D name] [-d directory] [-f file]
                                   [-C "directive"] [-c "directive"]
                                   [-k start|restart|graceful|graceful-stop|stop]
                                   [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S]
Options:
  -D name            : define a name for use in <IfDefine name> directives
  -d directory       : specify an alternate initial ServerRoot
  -f file            : specify an alternate ServerConfigFile
  -C "directive"     : process directive before reading config files
  -c "directive"     : process directive after reading config files
  -e level           : show startup errors of level (see LogLevel)
  -E file            : log startup errors to file
  -v                 : show version number
  -V                 : show compile settings
  -h                 : list available command line options (this page)
  -l                 : list compiled in modules
  -L                 : list available configuration directives
  -G                : list available configuration directives after loading conf file
  -t -D DUMP_VHOSTS  : show parsed settings (currently only vhost settings)
  -S                 : a synonym for -t -D DUMP_VHOSTS
  -t -D DUMP_MODULES : show all loaded modules
  -M                 : a synonym for -t -D DUMP_MODULES
  -t                 : run syntax check for config files
  -T                 : start without DocumentRoot(s) check

and last when i type 
tail -f /usr/local/apache/logs/error_log

[email protected] [~]# tail -f/usr/local/apache/logs/error_log
tail: invalid option -- /
Try `tail --help' for more information.
[email protected] [~]# tail -f /usr/local/apache/logs/error_log
[Thu Mar 24 01:25:03 2011] [error] [client 65.52.110.87] File does not exist: /home/pinditub/public_html/404.shtml
[Thu Mar 24 01:25:05 2011] [error] [client 65.52.110.87] File does not exist: /home/pinditub/public_html/2010
[Thu Mar 24 01:25:05 2011] [error] [client 65.52.110.87] File does not exist: /home/pinditub/public_html/404.shtml
[Thu Mar 24 01:25:05 2011] [error] [client 65.52.110.87] File does not exist: /home/pinditub/public_html/tag
[Thu Mar 24 01:25:05 2011] [error] [client 65.52.110.87] File does not exist: /home/pinditub/public_html/404.shtml
[Thu Mar 24 01:25:06 2011] [error] [client 65.52.110.87] File does not exist: /home/pinditub/public_html/2010
[Thu Mar 24 01:25:06 2011] [error] [client 65.52.110.87] File does not exist: /home/pinditub/public_html/404.shtml
[Thu Mar 24 01:25:55 2011] [error] [client 66.249.72.215] SoftException in Application.cpp:256: File "/home/pinditub/public_html/wp-trackback.php" is writeable by group
[Thu Mar 24 01:25:55 2011] [error] [client 66.249.72.215] Premature end of script headers: wp-trackback.php
[Thu Mar 24 01:25:55 2011] [error] [client 66.249.72.215] File does not exist: /home/pinditub/public_html/500.shtml
Please advise me
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
The command I provided has a lowercase el (-l) not a 1. You didn't copy and paste the command but typed in a -1 flag instead of the correct flag. Normally, it's easiest if you copy and paste the command into the shell to ensure you aren't typing it incorrectly.

As for the error, it isn't due to mod_rewrite at all, it tells what's the issue:

[Thu Mar 24 01:14:10 2011] [error] [client 66.249.72.215] SoftException in Application.cpp:256: File "/home/pinditub/public_html/wp-content/plugins/gd-star-rating/ajax.php" is writeable by group, referer: http://www.pinditube.com/2011/03/wat...orld-cup-2011/
You are running suPHP on the machine as the PHP handler I would imagine (you can check in WHM > Apache Configuration > PHP and SuExec Configuration area what handler is being used). Under suPHP, you cannot have files higher than 644 file permissions and you cannot have folders higher than 755 for permissions. Thus, do the following:

Code:
ls -lah /home/pinditub/public_html/wp-content/plugins/gd-star-rating/ajax.php
If you aren't certain how to read the permissions based on rwx for the numeric conversion, you can run this command instead to get the numeric output for the file permissions:

Code:
stat -c '%a %n' /home/pinditub/public_html/wp-content/plugins/gd-star-rating/ajax.php
If that file has permissions higher than 644, fix the permissions:

Code:
chmod 644 /home/pinditub/public_html/wp-content/plugins/gd-star-rating/ajax.php
 

Muhammad_1

Member
Mar 20, 2011
18
0
51
this is whm pHP and SuExec Configuration area
Current Configuration

Option Configured Value
Default PHP Version (.php files) 5
PHP 5 Handler suphp
PHP 4 Handler none

Apache suEXEC on
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Did you read my last post? I provided suggestions about the file having the wrong permissions. The error message says it does. Please re-read my entire last post.