Forum Moderators: phranque

Message Too Old, No Replies

Help with htaccess & subdomain

         

Kemble

6:40 pm on Feb 15, 2009 (gmt 0)

10+ Year Member



my .htaccess file is preventing me from reaching test.mydomain.com

I don't know the rules/language of rewrites, I've only copy & pasted what I was told to do when I installed certian shopping cart mods.

Here is my current .htaccess that is in both www.mydomain.com and in www.test.mydomain.com

Can someone tell me what I need to do to allow me access to www.test.mydomain.com?

AddHandler fastcgi-script .fcgi
Action hs-php4-script /php.fcgi
DirectoryIndex home.php index.php index.html index.htm

RewriteEngine On
RewriteRule ^blahblah/(.*)$ blahblah.php [L]
RewriteRule ^blahblah.html(.*)$ blahblah.php [L]
RewriteRule ^blahblah.html(.*)$ blahblah.php [L]
RewriteRule ^blahblah.html(.*)$ blahblah.php [L]
RewriteRule ^blahblah.html(.*)$ blahblah.php [L]
RewriteRule ^blahblah.html(.*)$ blahblah.php [L]
RewriteRule ^blahblah.html(.*)$ blahblah.php [L]
RewriteRule ^blahblah.html(.*)$ blahblah.php [L]
RewriteRule ^blahblah.html(.*)$ blahblah.php [L]
RewriteRule ^blahblah.html(.*)$ blahblah.php [L]
RewriteRule ^blahblah.html(.*)$ blahblah.php [L]
RewriteRule ^blahblah.html(.*)$ blahblah.php [L]
RewriteRule ^blahblah.html(.*)$ blahblah.php [L]
RewriteRule ^blahblah.html(.*)$ blahblah.php [L]
RewriteRule ^blahblah.html(.*)$ blahblah.php [L]
RewriteRule ^blahblah.html(.*)$ blahblah.php [L]

RewriteCond %{REQUEST_URI} !(/admin/¦/provider/)
RewriteCond %{REQUEST_FILENAME} !\.(jpg¦gif¦php)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ blahblah.php

Options +SymlinksIfOwnerMatch -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com [NC]
RewriteRule ^(.*)$ [mydomain.com...] [R=301,L]
</IfModule>

I also noticed that my https doesnt work for subdomains? Is there something I can do to allow it to work? or do I need an additional certificate for subdomains?

Thanks

jdMorgan

8:33 pm on Feb 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Kemble, and welcome to WebmasterWorld!

> I don't know the rules/language of rewrites, I've only copy & pasted what I was told to do when I installed certian shopping cart mods.

We'll be happy to help you learn enough about mod_rewrite to fix your own code, but this forum is not set up to write or fix your code for you -- There are simply too many requests, and not enough "helpers" to do that.

See the references cited in our Apache Forum Charter [webmasterworld.com]to get started.

The problems you describe all seem to originate from your last rule.
By excluding your test subdomain and requests on %{SERVER_PORT} 443, you should be able to get it working.

Also, depending on the exact meaning of all those "blahblah" URL patterns, you might be able to reduce them all to one or just a very few rules. There are many other opportunities here to improve the code and make it more robust.

Jim

Kemble

5:59 am on Feb 16, 2009 (gmt 0)

10+ Year Member



:(

Kemble

6:22 pm on Feb 16, 2009 (gmt 0)

10+ Year Member



All the blahblah is what I did to replace my websites file names. I did search for my solution on your site before I posted and I did learn that websites and file names should not be revealed, therefore I put in blahblah to cover these up.

So...

As far as the:
By excluding your test subdomain and requests on %{SERVER_PORT} 443, you should be able to get it working.
This is something one of the shopping cart mods had me put in for SEO & rewriting product pages to an html page for better SEO.

I tried deleting it, still no luck

I tried doing:
RewriteCond %{HTTP_HOST} !^www.test\.mydomain\.com [NC]
RewriteRule ^(.*)$ [test.mydomain.com...] [R=301,L]
Still no luck.

I have tried countless variations, no luck :(

Kemble

6:23 pm on Feb 16, 2009 (gmt 0)

10+ Year Member



I'm not even sure if the htaccess file I need to be working with will be the one for the www.test.mydomain.com or if I edit the one on my main www.mydomain.com

Kemble

6:59 pm on Feb 16, 2009 (gmt 0)

10+ Year Member



Things I've tried that do not work:
---------------------
RewriteCond %{HTTP_HOST} !^www\.test.mydomain\.com [NC]
RewriteRule ^(.*)$ [test.mydomain.com...] [R=301,L]
---------------------
Rewrite off (in the .htaccess of www.test.mydomain.com)
---------------------

Kemble

7:13 pm on Feb 16, 2009 (gmt 0)

10+ Year Member



I do not know why:
RewriteCond %{HTTP_HOST} !^www\.test.mydomain\.com [NC]
RewriteRule ^(.*)$ [test.mydomain.com...] [R=301,L]
does not work. It makes 100% sense to me.

Kemble

10:27 pm on Feb 16, 2009 (gmt 0)

10+ Year Member



Well.. thanks for the encouragement, however I've given up trying and have spent 2 days trying to figure things out by attempting to learn rewrite code and browsing countless forums for my answer. I have decided to just use www.mydomain.com/test/ instead. Took me a whole 2 minutes to get a test server set up of my shopping cart installed on www.mydomain.com/test rather than try to create it on a subdomain. oh well...

[edited by: Kemble at 10:28 pm (utc) on Feb. 16, 2009]