ModRewrite Help

I'm trying to use mod_rewrite to rewrite the URL displayed in the
browser address bar to the "www." form as described here:

http://httpd.apache.org/docs/2.0/rewrite/rewrite_guide.html# canonicalhost

This particular site is a ZenCart installation that is hosted. Thus I
have to use .htaccess files to make modifications.

I am already using a ZenCart module that rewrites URLs from a form such as:

http://alchemistswarehouse.com/store/index.php?main_page=pro duct_info&cPath=39&products_id=7296

to a more SEO friendly form like:

http://alchemistswarehouse.com/store/digital-products/card-t ricks-vol-1

I have these rules in my .htaccess file to accomplish the SEO friendly
rewrite:

#### BOF SSU
Options +FollowSymLinks -MultiViews
RewriteEngine On

# Make sure to change "zencart" to the subfolder you install ZC.
RewriteBase /store/

# Deny access from .htaccess
RewriteRule ^\.htaccess$ - [F]

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*) index.php?/$1 [E=VAR1:$1,QSA,L]
#### EOF SSU

To always rewrite the URL to http://www.alchemistswarehouse.com/*, I've
created this code:

RewriteCond %{HTTP_HOST} !^www\.alchemistswarehouse\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.alchemistswarehouse.com/$1 [R]

I have tried putting this code in my .htaccess file in different places
but it doesn't seem to have any effect. I've even removed the "L" flag
from the SSU RewriteRule above but still no luck.

What am I missing?

Thanks,

Drew

--
Be a Great Magician!
Visit The Alchemist's Warehouse

http://www.alchemistswarehouse.com



------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd.apache.org
" from the digest: users-digest-unsubscribe [at] httpd.apache.org
For additional commands, e-mail: users-help [at] httpd.apache.org
Drew Tomlinson [ Do, 21 Januar 2010 00:24 ] [ ID #2029439 ]

Re: ModRewrite Help

On Wed, Jan 20, 2010 at 6:24 PM, Drew Tomlinson <drew [at] mykitchentable.net> w=
rote:
> RewriteRule ^/(.*) =A0 =A0 =A0 =A0 http://www.alchemistswarehouse.com/$1 =
[R]
>
> I have tried putting this code in my .htaccess file in different places b=
ut
> it doesn't seem to have any effect. =A0I've even removed the "L" flag fro=
m the


This rule is a no-op in htaccess. In htaccess, the string you're
comparing to never has a leading slash -- the entire rewritebase is
stripped off ("/" is stripped off in the DocumentRoot, for example)

--
Eric Covener
covener [at] gmail.com

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd.apache.org
" from the digest: users-digest-unsubscribe [at] httpd.apache.org
For additional commands, e-mail: users-help [at] httpd.apache.org
Eric Covener [ Do, 21 Januar 2010 00:31 ] [ ID #2029440 ]

Re: ModRewrite Help

Eric Covener wrote:
> On Wed, Jan 20, 2010 at 6:24 PM, Drew Tomlinson <drew [at] mykitchentable.net> wrote:
>
>> RewriteRule ^/(.*) http://www.alchemistswarehouse.com/$1 [R]
>>
>> I have tried putting this code in my .htaccess file in different places but
>> it doesn't seem to have any effect. I've even removed the "L" flag from the
>>
>
>
> This rule is a no-op in htaccess. In htaccess, the string you're
> comparing to never has a leading slash -- the entire rewritebase is
> stripped off ("/" is stripped off in the DocumentRoot, for example)
>
Thanks for your reply. So is there any way to do what I want with .htaccess?

Cheers,

Drew

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd.apache.org
" from the digest: users-digest-unsubscribe [at] httpd.apache.org
For additional commands, e-mail: users-help [at] httpd.apache.org
Drew Tomlinson [ Do, 21 Januar 2010 01:57 ] [ ID #2029441 ]

Re: ModRewrite Help

On Wed, Jan 20, 2010 at 7:57 PM, Drew Tomlinson <drew [at] mykitchentable.net> w=
rote:
> Eric Covener wrote:
>>
>> On Wed, Jan 20, 2010 at 6:24 PM, Drew Tomlinson <drew [at] mykitchentable.net=
>
>> wrote:
>>
>>>
>>> RewriteRule ^/(.*) =A0 =A0 =A0 =A0 http://www.alchemistswarehouse.com/$=
1 [R]
>>>
>>> I have tried putting this code in my .htaccess file in different places
>>> but
>>> it doesn't seem to have any effect. =A0I've even removed the "L" flag f=
rom
>>> the
>>>
>>
>>
>> This rule is a no-op in htaccess. =A0In htaccess, the string you're
>> comparing to never has a leading slash -- the entire rewritebase is
>> stripped off =A0("/" is stripped off in the DocumentRoot, for example)
>>
>
> Thanks for your reply. So is there any way to do what I want with .htacce=
ss?

Yes, just use ^(.*) without the /, and make sure your htaccess is
being read at all (AllowOverride)


>
> Cheers,
>
> Drew
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project=
..
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe [at] httpd.apache.org
> =A0" =A0 from the digest: users-digest-unsubscribe [at] httpd.apache.org
> For additional commands, e-mail: users-help [at] httpd.apache.org
>
>



--
Eric Covener
covener [at] gmail.com

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd.apache.org
" from the digest: users-digest-unsubscribe [at] httpd.apache.org
For additional commands, e-mail: users-help [at] httpd.apache.org
Eric Covener [ Do, 21 Januar 2010 02:40 ] [ ID #2029443 ]
Webserver » gmane.comp.apache.user » ModRewrite Help

Vorheriges Thema: speaking url is not working inside subfolder
Nächstes Thema: Apache 2.2: mod_proxy_balancer does not work as documented?