Koozali.org: home of the SME Server

mod_rewrite

Offline haymann

  • *
  • 212
  • +0/-0
Re: mod_rewrite
« Reply #15 on: September 06, 2007, 10:05:45 PM »


haymann i tried your suggestion, but when i do that i now get 'forbidden' errors. Its obviously something but hasn't helped with mod-rewrite lol
Any further suggestions?
I had installed the WordPress contrib awhile back and have been using it since with no problems. I finally decided to see what I needed to do to get permalinks working and a forum search brought me back to this thread I was involved in some time ago... Has anyone been successful in getting permalinks to work?

I did try adding
Code: [Select]
$OUT .=    AllowOverride all\n"; to the /etc/e-smith/templates/etc/httpd/conf/httpd.conf/92wordpress file with hopes that would allow the .htaccess file to be used. I also ran this after I modified the file
Code: [Select]
expand-template /etc/httpd/conf/httpd.conf
/etc/init.d/httpd-e-smith restart
I know that is a messy way to do it, but I wanted to see if it worked, it didn't... :-(

Any suggestions?
Thanks,
Ryan

Offline haymann

  • *
  • 212
  • +0/-0
Re: mod_rewrite
« Reply #16 on: September 06, 2007, 11:17:10 PM »
A follow-up... I quite searching for permalinks and tried mod_rewrite instead and found this
I have just verified the above procedure using WAMP on Windows.
Here, it all works properly.

From the above error output I conclude that the .htaccess DOES WORK as the error message states "foo.php" and not "foo.html".  However, the base URL seems to be replaced by the base Dir.  I suspect there is some SME magic at work here that I don't know about yet.

=======
SOLUTION
=======
When I change
Code: [Select]
RewriteRule ^(.+)\.html$ $1.phpinto
Code: [Select]
RewriteRule ^(.+)\.html$ http://yourdomain.com/wordpress/$1.php [R]it however does work (hoorah!)

To test go here: http://coeleveld.com/imodrewrite
When change the .htaccess as the poster suggests, nothing changes for me. I am wondering if the way I tried to enable .htaccess was not proper? I wish that I understood enough of what was going on in /etc/e-smith/templates/etc/httpd/conf/httpd.conf/92wordpress to add the Rewrite stuff directly in there instead of the .htaccess...
Not sure if any of this helps...
Ryan

Offline slords

  • *****
  • 235
  • +3/-0
Re: mod_rewrite
« Reply #17 on: September 06, 2007, 11:48:23 PM »
If you look in the error_log for httpd it will tell you why it is failing.  mod_rewrite from .htaccess requires both the AllowOverride=All and FollowSymLinks=enabled for the ibay in question.  Those are the only changes I've had to make in order for wordpress permalinks to work fine.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs,
and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." -- Rich Cook

Offline haymann

  • *
  • 212
  • +0/-0
Re: mod_rewrite
« Reply #18 on: September 07, 2007, 04:54:46 AM »
Well I started typing this as I was trying some different things, so instead of deleting everything I'll go through the process...

If you look in the error_log for httpd it will tell you why it is failing.
I see a bunch of errors like this:
File does not exist: /home/e-smith/files/ibays/Primary/html/blah, blah, blah

Sounds like an issue w/ symlinks? I have wordpress installed in /opt/wordpress and have added symlinks to that location from my primary ibay. I did
Code: [Select]
db accounts setprop Primary FollowSymLinks enabledback when I first setup the symlinks. I just did
Code: [Select]
db accounts setprop Primary AllowOverride All
expand-template /etc/httpd/conf/httpd.conf
/etc/rc.d/rc7.d/S86httpd-e-smith restart
as I had not been using the .htaccess file before.

Then I looked and didn't see a symlink to the .htaccess file so I created it to /home/e-smith/files/ibays/Primary/html/ by using this
Code: [Select]
ln -s /opt/wordpress/.htaccess /home/e-smith/files/ibays/Primary/html/and the syslink appeared and the permalinks work. I have no idea why the link to .htaccess wasn't there before... I did this
Code: [Select]
ln -s /opt/wordpress/* /home/e-smith/files/ibays/Primary/html/ back when I first setup wordpress...

If I understand correctly, several folks here have suggested adding the .htaccess variables to the custom template instead of using .htaccess. I don't know how to do that with /etc/e-smith/templates/etc/httpd/conf/httpd.conf/92wordpress though...

b-t-w I am using the "stock" .htaccess that came w/ the wordpress contrib, with no modifications like I quoted in an early post on this thread. This is the .htaccess that I am using
Code: [Select]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
Thanks Shad :D
Ryan