Forum Moderators: phranque

Message Too Old, No Replies

make domain transparent htaccess problem

htaccess,directory index,rewrite rule,mod rewrite, transparent domain

         

mrseoer

6:26 am on Apr 28, 2010 (gmt 0)

10+ Year Member



hello all,

I have set up a website which runs on a private CMS hosted on H-Sphere parallels.

the default root folder to serve the domain is something like this:

/hsphere/local/home/.../example.com

now, my index.php resides in:

/hsphere/local/home/.../example.com/home/public/index.php

what I want is when users enter the domain name i.e.
http;//www.example.com

the index.php will be served and the URL must be transparent

I have set up an htaccess file in the root directory that goes like this:

RewriteRule ^/$ /home/public/index.php

however, it doesnt work. I'm getting the site without CSS and without internal links etc. (internal links lead to 404 error) if I remove the htaccess I'm getting the same.

In my CP, Indexes is set to "fancy" (other options are: "enabled", "disabled")

I cant seem to figure out the problem. Is my htaccess rule accurate?

thanks for the helpers...

g1smd

7:13 am on Apr 28, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your pattern of ^/$ will not match the request. The pattern should be ^$ when used in .htaccess files.

Once you fix that, you'll need to adjust the links that point to images, CSS and JS to this format <a href="/path/to/the-file"> with a leading slash. It is the browser that resolves those URLs based on the folder level of the currently viewed HTML page.

mrseoer

7:50 am on Apr 28, 2010 (gmt 0)

10+ Year Member



I have tried what you said but with no luck. it seems that the RewriteRule doesn't work at all!

can it be because "Indexes" is set to "fancy" thus retrieves the index.php automatically?

mrseoer

8:10 am on Apr 28, 2010 (gmt 0)

10+ Year Member



another thing I have forgot to mention, when entering the domain as: http://www.example.com it automatically converted to http://example.com without me adding a rewrite rule for that (in my CP www.example.com is set as alias for some reason and not vice versa how can changed that using a RewriteRule?)

lammert

9:40 am on Apr 28, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Some hosting companies do not allow some or all commands in .htaccess files. This is controlled with the AllowOverride tag in the central httpd.conf configuration file which is loaded when the web-server starts. Just to be sure that this isn't the case, you could ask your hosting provider if use of .htaccess files is allowed by the configuration.

mrseoer

9:56 am on Apr 28, 2010 (gmt 0)

10+ Year Member



yes! htaccess are allowed. (I use them for FriendlyUrls' and it works fine). plus, AllowOverride is set to "All"

what could be the case?
maybe the rewriteRule is no good?

I'm breaking my head to figure this thing out but with no success

jdMorgan

2:54 pm on Apr 28, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is that rule the only mod_rewrite directive in your .htaccess file?

Mod_rewrite requires that "RewriteEngine on" be set before any rewriterules are executed, and the whole mod_rewrite module must be enabled by setting FollowSymLinks or SymLinksIfOwnerMatch using an Options directive in .htaccess or a server config file.

Jim