Cant get rewrite_mod to work with SEO urls
Posted by: DeathfireD (---.hsd1.nh.comcast.net)
Date: May 01, 2010 12:48AM

I've been trying to get my .htaccess SEO urls to work with wamp but have had no success at all. The page loads as it normally would (ie. [localhost]) and seems to totally ignore the rewrite

1) I have the rewrite_mod enabled.

2) I know the following rewrite works on none WAMP servers
Options +FollowSymLinks
RewriteEngine On
RewriteRule index-id-(.*)\.html index.php?id=$1 [NC]

3) RewriteLog with level 9 turned on turns up no errors at all. I see loads of strip, apply, pass entries which indicate that the .htaccess file is at least being seen.

4) I've even tried going in and setting AllowOverride to "all" for the default

<Directory />
Options FollowSymLinks
AllowOverride all
Order deny,allow
Deny from all
</Directory>


None of this seems to work. Can someone point out what I'm doing wrong? It seriously cant be this complicated.

Options: ReplyQuote
Re: Cant get rewrite_mod to work with SEO urls
Posted by: toumimi (---.224.75-86.rev.gaoland.net)
Date: May 02, 2010 12:25PM

Hi,

You don't know how to rewrite url and should read some tutorials.
In fact, it's RewriteRule rewritted_url real_url [options]

So you must generate rewritted url into your code and htaccess will catch it and transmit it to index.php with id parameter that your script can use.
You see index-id-3 but you receive id=3 in your index.php file.

Use [localhost] in your url and it will load [localhost]

Note that you don't have to add -id- in your rewritted url as you can use regexp to interprate what you want.

Example :

RewriteRule (.*)\.html$ index.php?id=$1 [QSA,L]
=> Redirect pagename.html to index.php?id=pagename

Have fun with mod_rewrite smiling smiley

Florian

WampServer Patch (Screenshots)
Topic EN : www.wampserver.com
Topic FR : www.wampserver.com

Options: ReplyQuote
Re: Cant get rewrite_mod to work with SEO urls
Posted by: DeathfireD (---.hsd1.nh.comcast.net)
Date: May 03, 2010 03:00AM

Again, I know perfectly well how to program rewrite urls. As I've already said all the rewrites work perfectly fine on EVERY apache server I've tested except for the two using WAMP.

The above code IS in a .htaccess folder and again I know apache sees it since it's showing in the logs.

I've even tried your example which came up with nothing when going to [mydns]. When I try going to [mydns] or [localhost] I'm given a 400 bad request error.

Options: ReplyQuote
Re: Cant get rewrite_mod to work with SEO urls
Posted by: showstopper (---.rev.greendottt.net)
Date: May 04, 2010 08:34PM

try changing the code in the apache.conf file it should be there to i had the same problem before

Fitcom - Technology and SEO with a side of awesome

Installing and Configuring a WAMP Server in Windows 7 & 8

Options: ReplyQuote
Re: Cant get rewrite_mod to work with SEO urls
Posted by: DeathfireD (---.hsd1.nh.comcast.net)
Date: May 05, 2010 12:26AM

Do you mean the httpd.conf? Also what code should I change? I did try messing with the default
<Directory />
Options FollowSymLinks
AllowOverride all
Order deny,allow
Deny from all
</Directory>

but in the end that didn't seem to help.

Options: ReplyQuote
Re: Cant get rewrite_mod to work with SEO urls
Posted by: DeathfireD (---.hsd1.nh.comcast.net)
Date: May 09, 2010 09:15PM

Bump.....anyone?

Options: ReplyQuote
Re: Cant get rewrite_mod to work with SEO urls
Posted by: showstopper (---.rev.greendottt.net)
Date: May 11, 2010 12:29AM


Options: ReplyQuote
Re: Cant get rewrite_mod to work with SEO urls
Posted by: DeathfireD (---.hsd1.nh.comcast.net)
Date: May 14, 2010 12:20AM

well not sure what else to change. I've set all AllowOverride to All and I'm still seeing the default [localhost] when I click on a link. If I try going to [localhost] I get a "Bad Request" message.

Options: ReplyQuote
Re: Cant get rewrite_mod to work with SEO urls
Posted by: DeathfireD (---.hsd1.nh.comcast.net)
Date: May 14, 2010 12:44AM

hmm that should be http:// l o calhost/folder/index.php?id=pagename for the first one and http:// l o calhost/folder/pagename.html for the second.

Options: ReplyQuote
Re: Cant get rewrite_mod to work with SEO urls
Posted by: DeathfireD (---.hsd1.nh.comcast.net)
Date: May 21, 2010 02:40AM

Figured it out.

RewriteRule index-id-(.*)\.html index.php?id=$1 [NC] apparently does not work unless you give it the direct path to the folder. (ex. RewriteRule index-id-(.*)\.html /test/folder/index.php?id=$1 [NC] ).

I'm really not sure why it works on Apache as apposed to WAMP though. O well, at least it works now.

Options: ReplyQuote


Sorry, only registered users may post in this forum.