DeveloperSide.NET Forums

DeveloperSide.NET => Web.Developer Server Suite Community Edition,
Public Support Forum => Topic started by: night2dark2 on July 24, 2008, 09:00:51 PM



Title: mod rewrite help?
Post by: night2dark2 on July 24, 2008, 09:00:51 PM
Well mod rewrite isn't being activated.

I know my rewrite rules are correct but they arent working.

I have 2 .htaccess. See if im doing something wrong.

This one is at the root of the vhost.

Quote from: root .htaccess
RewriteEngine on
RewriteRule ^testing/news/([0-9][0-9])$ /testing/news/$1/ [R]
RewriteRule ^testing/news/([0-9][0-9])/$ /testing/news.php?newsid=$1

And this one is in the directory

Quote from:  directory .htaccess
RewriteEngine on
RewriteRule ^news/([0-9][0-9])$ /news/$1/ [R]
RewriteRule ^news/([0-9][0-9])/$ /news.php?newsid=$1

What am i doing wrong?

you can go test that out
http://cp.revgamers.net/tesitng/news/1/

news.php?newsid=1 is supposed to be letting that be executed but its not.


Title: Re: mod rewrite help?
Post by: admin on July 24, 2008, 09:26:47 PM
Have you checked error.log?

Also note that you have to have 'Options FollowSymLinks' on for the Directory and at least an 'AllowOverride FileInfo' there as well.

You can also put mod_rewrite into debug mode and it will show you exactly what it is doing, though it's quite a bit of information.

Check http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriteloglevel and the RewriteLog directive.


Title: Re: mod rewrite help?
Post by: night2dark2 on July 24, 2008, 09:42:52 PM
this is my .htaccess now but now its giving internal server error when i request it.
Quote from: htaccess
Options FollowSymLinks
RewriteEngine on
RewriteLog "/www/vhosts/cp.revgamers.net/tesitng/erorr/rewrite.log"
RewriteLogLevel 3
RewriteCond %{QUERY_STRING} ^newsid=([$&]+)$
RewriteRule ^news/([0-9][0-9])$ //news/$1/ [R]
RewriteRule ^news/([0-9][0-9])/$ /news.php?newsid=$1

Thats the one inside C:\www\vhosts\cp.revgamers.net\testing\


Title: Re: mod rewrite help?
Post by: admin on July 24, 2008, 09:52:58 PM
Options and AllowOverride directives can only go into the main configurations files. You cannot place them inside .htaccess files.


Title: Re: mod rewrite help?
Post by: night2dark2 on July 24, 2008, 10:01:39 PM
Okay Options are set to all and allowoverride is already all. and its still not working


Title: Re: mod rewrite help?
Post by: night2dark2 on July 24, 2008, 10:15:40 PM
this is my htaccess
Quote from: htaccess
RewriteEngine on
RewriteRule ^testing/news/([0-9][0-9])$ /testing/news/$1/ [R]
RewriteRule ^testing/news/([0-9][0-9])/$ /testing/news.php?newsid=$1

And this is how i have hte vhost setup/
Quote from: vhosts
<VirtualHost *:80>
   ServerName cp.revgamers.net
   ServerAlias cp.revgamers.net
   DocumentRoot "/www/vhosts/cp.revgamers.net"
   ErrorLog /www/Apache22/logs/error.log

   <Directory "/www/vhosts/cp.revgamers.net">
      Options All
      AllowOverride All
      order allow,deny
      allow from all
   </Directory>

   <Directory "/www/vhosts/cp.revgamers.net/testing/">
      AllowOverride FileInfo
   </Directory>
</VirtualHost>


Title: Re: mod rewrite help?
Post by: night2dark2 on July 25, 2008, 01:29:40 AM
Its still not working. help please


Title: Re: mod rewrite help?
Post by: admin on July 25, 2008, 03:19:15 AM
Take out that 1st rule and use this instead...
RewriteRule ^testing/news/([0-9]+)/$ /testing/news.php?newsid=$1

That should rewrite /tesitng/news/1/ to /testing/news.php?newsid=1


Title: Re: mod rewrite help?
Post by: night2dark2 on July 25, 2008, 02:15:17 PM
Okay i got mod rewrite to work by referencing into my vbseo's htaccess configuration. But heres my problem now. My images arent all being included like http://cp.revgamers.net/testing/images/ their just being included as images/image.png so i get an empty effect. So how am i supposed to fix this now since the site doesn't like that prefix when using mod rewrite.

this is my mod-rewrite config now

Quote from: config
Options +FollowSymLinks
# Note Options +FollowSymLinks work inside because vbseo has the same inside of it
# Rewrite Engine Turn on
RewriteEngine On
#Say what the base to be rewritten
RewriteBase /testing
# Rewrite news/ to news.php
RewriteRule ^news/$ news.php [L]
#Rewrite news/blah to news/blah/
RewriteRule ^news/([0-9]+)$ news/$1/ [L]
#Rewrite news/blah/ to news.php?newsid=blah
RewriteRule ^news/([0-9]+)/$ news.php?newsid=$1