Forum Moderators: phranque

Message Too Old, No Replies

Multiple domains and folders

Not able to manage folders once

         

libonati

1:28 pm on Jan 20, 2010 (gmt 0)

10+ Year Member



Hello,

I have an issue on my .htaccess and I'm really not able to sort.com out.

I manage multiple web.comes tru the same hosting space using .htaccess and folders. So when one types mydomain.com, the user will see content that is inside the folder ./mydomain/

Inside ./mydomain/ folder I have installed wordpress.
Since all links are relative, they change in mydomain.com/mydomain/ and nothing works (css, javascript and so on)

Is there a method to sort.com out tru .htaccess?

Here.com is the content of mine .htaccess
<snip>

Thank you!

RewriteEngine On

RewriteRule ^example-([A-Z,a-z,0-9-]*)\.html$ example-marketing/search.php?query=$1 [L]
RewriteRule ^example-([A-Z,a-z,0-9-]*)$ example-marketing/search.php?.comy=$1 [L]

RewriteCond %{HTTP_HOST} ^(example-hostess\.com¦example-marketing\.com¦example\.com)$ [NC]
RewriteRule ^(.*)$ [%1...] [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST}/example-hostess ^www\.example-hostess\.com(/example-hostess)$ [NC,OR]
RewriteCond %{HTTP_HOST}/example-marketing ^www\.example-marketing\.com(/example-marketing)$ [NC,OR]
RewriteCond %{HTTP_HOST}/kere ^www\.example\.com(/kere)$ [NC]
RewriteRule !^(css¦images)(/.*)?$ %1%{REQUEST_URI} [QSA,L] ew.comeRule ^example-([A-Z,a-z,0-9-]*)\.html$ example-marketing/search.php?query=$1 [L]
RewriteRule ^example-([A-Z,a-z,0-9-]*)$ example-marketing/search.php?.comy=$1 [L]

RewriteCond %{HTTP_HOST} ^(example-hostess\.com¦example-marketing\.com¦example\.com)$ [NC]
RewriteRule ^(.*)$ [%1...] [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST}/example-hostess ^www\.example-hostess\.com(/example-hostess)$ [NC,OR]
RewriteCond %{HTTP_HOST}/example-marketing ^www\.example-marketing\.com(/example-marketing)$ [NC,OR]
RewriteCond %{HTTP_HOST}/kere ^www\.example\.com(/kere)$ [NC]
RewriteRule !^(css¦images)(/.*)?$ %1%{REQUEST_URI} [QSA,L]

[edited by: jdMorgan at 3:25 am (utc) on Jan. 21, 2010]
[edit reason] No URLs, please. See Terms of Service. [/edit]

jdMorgan

3:23 am on Jan 21, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's not clear whether the last rule was pre-existing or was added in an attempt to fix the relative-linking problem with css and image objects.

Please give an example of a 'broken' css or image URL, as requested by the client, and then give the correct URL that should be used. It's not easy to determine this from just looking at the code.

Also, your third rule (external redirect) should go first, unless you want to expose the filepaths in the first two rules as URLs to the client -- which is unlikely.

Jim

g1smd

8:18 am on Jan 21, 2010 (gmt 0)

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



Replace [A-Z,a-z,0-9-] with [a-z0-9-] and add the [NC] flag to make this code run faster.

Remove the commas unless you really do have commas in your URLs. If you do, only list the comma once.

Make sure that external redirects are listed before all the rewrites. Currently you have rewrites ahead of two of your redirects.

libonati

9:14 am on Jan 21, 2010 (gmt 0)

10+ Year Member




The last rule was pre-existing. I use that rule for example-hostess and example-marketing.

The issue is in example.com. If I type www.example.com, the .htaccess should let me see what is in "kere" folder.
This works, BUT all paths are with this structure: www.example.com/kere/css/mycss.css or www.example.com/kere/js/myjs.js

What I wish is that all paths will remain with this structure (whitout kere folder):
www.example.com/css/mycss.css or www.example.com/js/myjs.js

Thank you for your help!

jdMorgan

9:00 pm on Jan 21, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Look at the URLs being requested from your server using an HTTP headers checker. If they include the 'kere' path-part, then the problem is in the script that produces those pages, and cannot be fixed by mod_rewrite.

Jim