Mod_rewrite installed but is not working

Support for webhosts that use CentOS
kendo
Posts: 4
Joined: 2011/05/31 05:30:09

Mod_rewrite installed but is not working

Post by kendo » 2011/05/31 05:42:39

I have problems running WordPress on my site because when I choose to use "permalinks" which requires mod-rewrite, all I get is a 404 page not found. After performing some tests to detect that mod-rewrite is installed and enabled I find that all configurations tell it to work bit it doesn't.

Http.conf is correct and the libraries are installed, but the following test fails...

Options +FollowSymLinks
Redirect /test.html http://www.yahoo.com

I am running CentOS 5 64-bit without Control Panel interference.

Any clues?

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Mod_rewrite installed but is not working

Post by pschaff » 2011/05/31 18:48:20

Welcome to the CentOS fora. Reading [url=https://www.centos.org/modules/newbb/viewforum.php?forum=47]FAQ & Readme First[/url] is recommended for new users.

Doing[code]yum provides \*mod_rewrite\*[/code] shows that is part of httpd and is documented in file:///var/www/manual/mod/mod_rewrite.html but WordPress is not part of CentOS. There are packages available from EPEL. Hard for anyone to be sure your httpd.conf is correct without seeing it.

Please tell us how you installed wordpress and [url=http://www.centos.org/modules/newbb/viewtopic.php?topic_id=25128&forum=47]provide more information about your system[/url].

kendo
Posts: 4
Joined: 2011/05/31 05:30:09

Re: Mod_rewrite installed but is not working

Post by kendo » 2011/06/01 06:00:16

Thanks for responding. I ran the yum line and there was no change. My getinfo.txt file is attached. Currently my .htaccess file looks like...

Options -indexes +FollowSymLinks
Redirect /joomla.html http://www.joomla.org


order allow,deny
deny from all


# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

http://beseen.addmine.com/joomla.html gives a 404 and tells me that mod_rewrite is not working at all.

WordPress was installed by running an install script that comes with the download, but it's not only WP that is not working... mod_rewrite seems to be installed and enabled in httpd.conf but it doesn't work for my test or anything else.

This server is a hosted VPS and the host is MIA... they are not responding. I asked for a rebuild without their usual Control Panel because it was too limiting. Instead I opted to use Webmin, but I have a sneaky suspicion that my troubles may have something to do with them installing that CP and then removing it. Beats me, I am used to Windows and Classic ASP.

kendo
Posts: 4
Joined: 2011/05/31 05:30:09

Re: Mod_rewrite installed but is not working

Post by kendo » 2011/06/01 06:02:23

First attachment failed... the upload folder hasn't got suitable write permissions.

Information for general problems.
[code]
== BEGIN uname -rmi ==
2.6.18-028stab070.14 x86_64 x86_64
== END uname -rmi ==

== BEGIN rpm -qa \*-release\* ==
centos-release-notes-5.6-0
centos-release-5-6.el5.centos.1
== END rpm -qa \*-release\* ==

== BEGIN cat /etc/redhat-release ==
CentOS release 5.6 (Final)
== END cat /etc/redhat-release ==

== BEGIN getenforce ==
Disabled
== END getenforce ==

== BEGIN free -m ==
total used free shared buffers cached
Mem: 1024 252 771 0 0 0
-/+ buffers/cache: 252 771
Swap: 0 0 0
== END free -m ==

== BEGIN rpm -q yum rpm python ==
yum-3.2.22-33.el5.centos
rpm-4.4.2.3-22.el5
python-2.4.3-44.el5
== END rpm -q yum rpm python ==

== BEGIN ls /etc/yum.repos.d ==
CentOS-Base.repo
CentOS-Debuginfo.repo
CentOS-Media.repo
CentOS-Vault.repo
== END ls /etc/yum.repos.d ==

== BEGIN cat /etc/yum.conf ==
[main]
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
distroverpkg=redhat-release
tolerant=1
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum

# Note: yum-RHN-plugin doesn't honor this.
metadata_expire=1h

installonly_limit = 5

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
== END cat /etc/yum.conf ==

== BEGIN yum repolist all ==
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id repo name status
C5.0-base CentOS-5.0 - Base disabled
C5.0-centosplus CentOS-5.0 - Plus disabled
C5.0-extras CentOS-5.0 - Extras disabled
C5.0-updates CentOS-5.0 - Updates disabled
C5.1-base CentOS-5.1 - Base disabled
C5.1-centosplus CentOS-5.1 - Plus disabled
C5.1-extras CentOS-5.1 - Extras disabled
C5.1-updates CentOS-5.1 - Updates disabled
C5.2-base CentOS-5.2 - Base disabled
C5.2-centosplus CentOS-5.2 - Plus disabled
C5.2-extras CentOS-5.2 - Extras disabled
C5.2-updates CentOS-5.2 - Updates disabled
C5.3-base CentOS-5.3 - Base disabled
C5.3-centosplus CentOS-5.3 - Plus disabled
C5.3-extras CentOS-5.3 - Extras disabled
C5.3-updates CentOS-5.3 - Updates disabled
C5.4-base CentOS-5.4 - Base disabled
C5.4-centosplus CentOS-5.4 - Plus disabled
C5.4-extras CentOS-5.4 - Extras disabled
C5.4-updates CentOS-5.4 - Updates disabled
C5.5-base CentOS-5.5 - Base disabled
C5.5-centosplus CentOS-5.5 - Plus disabled
C5.5-extras CentOS-5.5 - Extras disabled
C5.5-updates CentOS-5.5 - Updates disabled
base CentOS-5 - Base enabled: 9,526
c5-media CentOS-5 - Media disabled
debug CentOS-5 - Debuginfo disabled
update CentOS-5 - Updates enabled: 5,682
repolist: 15,208
== END yum repolist all ==

== BEGIN egrep 'include|exclude' /etc/yum.repos.d/*.repo ==
== END egrep 'include|exclude' /etc/yum.repos.d/*.repo ==

== BEGIN sed -n -e "/^\[/h; /priority *=/{ G; s/\n/ /; s/ity=/ity = /; p }" /etc/yum.repos.d/*.repo | sort -k3n ==
priority = 1 [base]
priority = 1 [update]
== END sed -n -e "/^\[/h; /priority *=/{ G; s/\n/ /; s/ity=/ity = /; p }" /etc/yum.repos.d/*.repo | sort -k3n ==

== BEGIN cat /etc/fstab ==
none /dev/pts devpts rw 0 0
== END cat /etc/fstab ==

== BEGIN df -h ==
Filesystem Size Used Avail Use% Mounted on
/dev/vzfs 40G 647M 40G 2% /
/dev/simfs 40G 647M 40G 2% /tmp
/dev/simfs 40G 647M 40G 2% /var/tmp
none 512M 4.0K 512M 1% /dev
== END df -h ==

== BEGIN fdisk -l ==
cannot open /proc/partitions
== END fdisk -l ==

== BEGIN blkid ==
== END blkid ==

== BEGIN cat /proc/mdstat ==
cat: /proc/mdstat: No such file or directory
== END cat /proc/mdstat ==

== BEGIN lvdisplay ==
No volume groups found
== END lvdisplay ==

== BEGIN rpm -qa kernel\* | sort ==
kernel-headers-2.6.18-238.9.1.el5
== END rpm -qa kernel\* | sort ==

== BEGIN lspci ==
./getinfo.sh: line 87: lspci: command not found
== END lspci ==

== BEGIN lspci -n ==
./getinfo.sh: line 87: lspci: command not found
== END lspci -n ==

== BEGIN lsusb ==
./getinfo.sh: line 87: lsusb: command not found
== END lsusb ==

== BEGIN ifconfig -a ==
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:123085 errors:0 dropped:0 overruns:0 frame:0
TX packets:123085 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:30191539 (28.7 MiB) TX bytes:30191539 (28.7 MiB)

venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:127.0.0.1 P-t-P:127.0.0.1 Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:171053 errors:0 dropped:0 overruns:0 frame:0
TX packets:193799 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:59010264 (56.2 MiB) TX bytes:110402286 (105.2 MiB)

venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:74.200.85.166 P-t-P:74.200.85.166 Bcast:74.200.85.166 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1

venet0:1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:74.204.171.245 P-t-P:74.204.171.245 Bcast:74.204.171.245 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1

== END ifconfig -a ==

== BEGIN route -n ==
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
191.255.255.0 0.0.0.0 255.255.255.0 U 0 0 0 venet0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 venet0
0.0.0.0 191.255.255.1 0.0.0.0 UG 0 0 0 venet0
== END route -n ==

== BEGIN cat /etc/resolv.conf ==
nameserver 74.200.85.166
nameserver 205.177.13.7
nameserver 205.234.103.204
== END cat /etc/resolv.conf ==

== BEGIN grep net /etc/nsswitch.conf ==
#networks: nisplus [NOTFOUND=return] files
#netmasks: nisplus [NOTFOUND=return] files
netmasks: files
networks: files
netgroup: nisplus
== END grep net /etc/nsswitch.conf ==

== BEGIN chkconfig --list | grep -Ei 'network|wpa' ==
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
== END chkconfig --list | grep -Ei 'network|wpa' ==

[/code]

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Mod_rewrite installed but is not working

Post by pschaff » 2011/06/01 13:56:03

[quote]
kendo wrote:
Thanks for responding. I ran the yum line and there was no change.[/quote]
Any change would have been a surprise. That line just queries the metadata to see what provides the capability.

[quote]
My getinfo.txt file is attached.[/quote]
The forum attachment function is permanently broken.

You are not running CentOS - looks like OpenVZ from the kernel - so problems are not surprising. Please see
[url=http://wiki.centos.org/AdditionalResources/OtherVoices]Other Voices[/url]
[url=http://wiki.centos.org/TipsAndTricks/BrokenSpins]When CentOS Is Not CentOS[/url]

Your repo configuration is non-standard as well. The core repos addons, centosplus, and extras are missing and you have update rather than update[color=660000]s[/color].

You do not have the yum-priorities plugin installed, but if you do and use the standard repo configs your [updates] repo will default to 99 - the lowest priority as it is currently undefined.
[code]priority = 1 [update] [/code]
should be
[code]priority = 1 [update[b][color=660000]s[/color][/b]] [/code]

[quote]
Currently my .htaccess file looks like...

Options -indexes +FollowSymLinks
Redirect /joomla.html http://www.joomla.org


order allow,deny
deny from all


# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

http://beseen.addmine.com/joomla.html gives a 404 and tells me that mod_rewrite is not working at all.[/quote]
Will await comment on that from someone who knows more about Apache than I, but is there an uncommented line[code]LoadModule rewrite_module modules/mod_rewrite.so
[/code]in /etc/httpd/conf/httpd.conf ?

[quote]
WordPress was installed by running an install script that comes with the download, but it's not only WP that is not working... mod_rewrite seems to be installed and enabled in httpd.conf but it doesn't work for my test or anything else.[/quote]
Why not use an EL5 package since it is available for EPEL? Installing from a script is likely to be problematic as it may not install a compatible version. Package based systems should use packages if at all possible.

Please read about [url=http://www.centos.org/modules/newbb/viewtopic.php?topic_id=14408&forum=47]Installing Software[/url], [url=http://wiki.centos.org/PackageManagement/SourceInstalls]Source Installs[/url], and [url=http://wiki.centos.org/AdditionalResources/Repositories]Repositories[/url], and note the warnings and advice about installing and configuring the [url=http://wiki.centos.org/PackageManagement/Yum/Priorities]yum priorities plugin[/url]. Non-core repos should have a higher numeric value, which is a lower priority. Lower is "better" as in golf scores.

[quote]
This server is a hosted VPS and the host is MIA... they are not responding. I asked for a rebuild without their usual Control Panel because it was too limiting. Instead I opted to use Webmin, but I have a sneaky suspicion that my troubles may have something to do with them installing that CP and then removing it. Beats me, I am used to Windows and Classic ASP.[/quote]
Not sure the provider is going to be much help, but you should ask as advice from here could break your system. I would think installing the WordPress packages from EPEL should be OK, but it is not clear what they have done to the standard CentOS repo configs.

kendo
Posts: 4
Joined: 2011/05/31 05:30:09

Re: Mod_rewrite installed but is not working

Post by kendo » 2011/06/01 14:49:19

The loadModule line is uncommented and the .so package is where it should be for 64-bit.

Looks like WordPress is only available from them. The install script only reads a config file and creates a MySQL database to use, not much else so that's not the problem. Symbolic links are not working at all so something is amiss and it looks like I should bother the cPanel people for this.

Thanks for your time.

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Mod_rewrite installed but is not working

Post by pschaff » 2011/06/01 17:35:31

[quote]
kendo wrote:
The loadModule line is uncommented and the .so package is where it should be for 64-bit.

Looks like WordPress is only available from them. [/quote]

# yum --enablerepo epel list wordpress\*
Loaded plugins: allowdowngrade, downloadonly, fastestmirror, priorities
Loading mirror speeds from cached hostfile
* epel: mirror.vcu.edu
* rpmforge: ftp-stud.fht-esslingen.de
Excluding Packages in global exclude list
Finished
Excluding Packages from CentOS-5 - Plus
Finished
Excluding Packages from RHEL 5 - RPMforge.net - dag
Finished
5319 packages excluded due to repository priority protections
Available Packages
wordpress.noarch 3.1.2-1.el5 epel
wordpress-mu.noarch 2.9.2-3.el5 epel
wordpress-mu-plugin-add-to-any.noarch 0.9.9.2.3-1.el5 epel
wordpress-mu-plugin-add-to-any-subscribe.noarch 0.9.6.4.1-1.el5 epel
wordpress-mu-plugin-defaults.noarch 1.2.3-3.el5 epel
wordpress-plugin-add-to-any.noarch 0.9.9.2.3-1.el5 epel
wordpress-plugin-add-to-any-i18n.noarch 0.9.9.2.3-1.el5 epel
wordpress-plugin-add-to-any-subscribe.noarch 0.9.6.4.1-1.el5 epel
wordpress-plugin-add-to-any-subscribe-i18n.noarch 0.9.6.4.1-1.el5 epel
wordpress-plugin-bad-behavior.noarch 2.0.42-1.el5 epel
wordpress-plugin-defaults.noarch 2.1-1.el5 epel


[quote]
The install script only reads a config file and creates a MySQL database to use, not much else so that's not the problem.[/quote]
OK. I plead ignorance. :-)

[quote]
Symbolic links are not working at all so something is amiss and it looks like I should bother the cPanel people for this.[/quote]
That sounds like a major problem that I don't recall seeing before, but some of these VPSs seem to be very strange beasts.

[quote]
Thanks for your time.[/quote]
You are welcome and good luck. Please update the thread with what you learn.

khalilamar
Posts: 1
Joined: 2014/02/27 12:24:40

Re: Mod_rewrite installed but is not working

Post by khalilamar » 2014/02/27 12:34:39

Open the Apache configuration file located at /etc/httpd/conf/httpd.conf
Change AllowOverride None to AllowOverride All inside the DocumentRoot Directory Directive, normally <Directory "/var/www/html">

save and quit vi emacs or nano
back to the shell terminal, run this command to restart the apache web server and take in consideration the .htaccess files rules and the rewrite rules written within.

service httpd restart

go to wordpress backend. open Settings > Permalinks
and put back the setting Post name instead of Default

craigkeefner
Posts: 1
Joined: 2014/04/01 17:08:28

Re: Mod_rewrite installed but is not working

Post by craigkeefner » 2014/04/01 17:15:33

Was there a solution to this. I have the same problem. Appears in conf that rewrite installed but it doesn't work. I tried using the same joomla test script and I get 404. It is Wordpress 3.8.1 and the permalinks that first triggered me

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: Mod_rewrite installed but is not working

Post by gerald_clark » 2014/04/01 20:05:00

If you actually have the same problem, contact your cPanel support because cPanel replaces all these programs with their own,
and we can't support them.

Post Reply