ModRewrite Help

ModRewrite Help

am 21.01.2010 00:24:03 von Drew Tomlinson

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 for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: ModRewrite Help

am 21.01.2010 00:31:12 von Eric Covener

On Wed, Jan 20, 2010 at 6:24 PM, Drew Tomlinson 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)

--=20
Eric Covener
covener@gmail.com

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: ModRewrite Help

am 21.01.2010 01:57:55 von Drew Tomlinson

Eric Covener wrote:
> On Wed, Jan 20, 2010 at 6:24 PM, Drew Tomlinson 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 for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: ModRewrite Help

am 21.01.2010 02:40:55 von Eric Covener

On Wed, Jan 20, 2010 at 7:57 PM, Drew Tomlinson w=
rote:
> Eric Covener wrote:
>>
>> On Wed, Jan 20, 2010 at 6:24 PM, Drew Tomlinson >
>> 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 for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> =A0" =A0 from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>



--=20
Eric Covener
covener@gmail.com

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org