Hi,
Sorry but that information is wrong. Matching !^/editors.* or !^/editors is effectively the same as far these rules are concerned.
.* simply means "match any or no further characters".
So it's fine to have it.
You can read more about this if you search for "regular expressions" on the net.
All the best..
Conor
ceon
Hi,
As far as I can see, this part will never match.
The %{REQUEST_URI} variable doesn't include the host name.
It would only match if you were matching against %{HTTP_HOST}
You are hijacking this thread somewhat to sort out your own hosting problems.
Rather than you posting lots of times I'd rather have a quick go and trying out an option or two to sort this out.
Please send me FTP details for your site and I'll try out a few ideas I have to get this working for you.
I may or may not be able to do that today depending on whether or not I can get internet access later... I'll be off for the Easter Holidays shortly.
All the best...
Conor
ceon
Hi,
Thanks for the info!
It sounds like a stupid way to set up a website. How hard is it to set up a VirtualHost directive so each additional domain is its own website?!
Some companies just don't have a clue unfortunately!
All the best..
Conor
ceon
I'm pretty sure thats the way it does work. When you enter the info for the add-on domain, the software creates the proper virthost directives.
Some of the certified hosts offer this like coughcamelotcough. Maybe one of those guys could jump in and explain how its really done. I'm guessing the web root directive in the container just points to a sub-dir of the main account.
This is Server Configuration Code. The entire .htaccess file is parsed at least once for every URL request arriving at the server.Code:.* simply means "match any or no further characters". So it's fine to have it.
That being so, the file should use the most efficient code to get the job done. In this case, trailing .* characters on multiple patterns waste CPU cycles that you might later need elsewhere in serving the pages.
General rule of thumb is to only include such patterns when you need to capture the information in a backreference for later use.
Additionally, every RewriteRule should have the [L] flag to end Mod_Rewrite processing when that rule has matched the current request.
I've seen too many site owners forced into early server upgrades, when in actual fact inefficient code had wasted vast amounts of processing power.
This code *is* trivial but because it is core to server operation, getting the best possible efficiency is important.
Hi, I'm not sure if this is the correct place to ask this but I think it may be an issue with this mod.
I've been testing my site's performance using this tool:
http://www.websiteoptimization.com/services/analyze/
When I used the tool to analyse this page:
http://www.snowrepublic.co.uk/FilesS...mondFile100X25
It is coming back with images not found even though the images are being displayed when I look at the page with my browser.
The path it is saying the images exist on are http://www.snowrepublic.co.uk/FilesStones/images/
but the real path should be http://www.snowrepublic.co.uk/images/
Is there a problem with this mod?
If so, am I seeing my images because my browser has cached them before I installed this mod?
Any help would be grately appreciated.
It may be a problem with the analysis tool; I've asked at weboptimization.com to see what they think.
I'll post their response when I get it.
Guys,
I've just glanced a bit at the discussion here, so don't know if I'm capturing everything, but...
I'm using an add-on domain from my hosting provider (Midphase) for my website (www.edizioninautilus.it) and it is able to successfully handle Conor's great URI mapping module.
The add-on domain is all hosted in a sub-directory under the main domain files. I've simply followed the .htaccess rules in Conor's docs and placed that .htaccess file in the root directory of the subdirectory. All seems well.
If you're interested, here's a snapshot of my .htaccess:
RewriteEngine on
Options All -Indexes
RewriteCond %{HTTP_HOST} ^nautilustorino.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.nautilustorino.com$
RewriteRule ^/?$ "http\:\/\/www\.edizioninautilus\.it" [R=301,L]
RewriteCond %{HTTP_HOST} ^edizioninautilus.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.edizioninautilus.com$
RewriteRule ^/?$ "http\:\/\/www\.edizioninautilus\.it" [R=301,L]
RewriteCond %{HTTP_HOST} ^nautilustorino.it$ [OR]
RewriteCond %{HTTP_HOST} ^www.nautilustorino.it$
RewriteRule ^/?$ "http\:\/\/www\.edizioninautilus\.it" [R=301,L]
redirect 301 "/Libri/5000 anni fa - Chiomonte.html" http://www.edizioninautilus.it/5000-anni-fa-chiomonte
redirect 301 "/Libri/Archeologia del Ferro.html" http://www.edizioninautilus.it/archeologia-del-ferro
.
.
.
ErrorDocument 404 /index.php?main_page=page_not_found
# Don't rewrite any URIs ending with a file extension (ending with .[xxxx])
RewriteCond %{REQUEST_URI} !\.[a-zA-Z]{2,4}$
# Don't rewrite admin directory
RewriteCond %{REQUEST_URI} !^/zzzzzzz.* [NC]
# Don't rewrite editors directory
RewriteCond %{REQUEST_URI} !^/editors.* [NC]
# Don't rewrite payment pages/callback handlers
# (Won't be rewritten by rules above but included here in case rewriting of URIs ending in .php is added)
RewriteCond %{REQUEST_URI} !^/ipn_main_handler.php.* [NC]
RewriteCond %{REQUEST_URI} !^/iridium_3d_secure_iframe.php.* [NC]
RewriteCond %{REQUEST_URI} !^/localities_remote_loader.php.* [NC]
RewriteCond %{REQUEST_URI} !^/nochex_apc_handler.php.* [NC]
RewriteCond %{REQUEST_URI} !^/protx_direct_3d_secure_iframe.php.* [NC]
RewriteCond %{REQUEST_URI} !^/realex_remote_3d_secure_iframe.php.* [NC]
# Don't rewrite cPanel directories
RewriteCond %{REQUEST_URI} !/cpanel.* [NC]
RewriteCond %{REQUEST_URI} !/frontend.* [NC]
# Handle all other URIs using Zen Cart (index.php)
RewriteRule (.*) index.php?%{QUERY_STRING} [L]
I left out a bunch of 301 redirects where the . . . s are in the cut and paste job above because there are a ton of them and they are ultimately just a repeat of the first two that I included.
Hope that helps some.
Jeremy
Here's some hints to make the code much more efficient or correct common errors:
A local OR will parse faster when used in .htaccess. Do also remember to escape periods in patterns:Code:RewriteCond %{HTTP_HOST} ^(www\.)?nautilustorino\.com$
Escape special characters when used in patterns, but NOT in the target URL or filepath. End the domain name with a trailing slash:Code:RewriteRule ^/?$ "http://www.edizioninautilus.it/" [R=301,L]
You cannot guarantee module execution order on the server so never mix Redirect and RedirectMatch directives in the same file where RewriteRule is in use. Use RewriteRule for ALL of your redirects and rewrites:If you mix directives, and you have rewrites parsed before redirects, you'll end up exposing server internal filepaths as URLs.Code:RewriteRule "Libri/5000 anni fa - Chiomonte.html" http://www.edizioninautilus.it/5000-anni-fa-chiomonte [R=301,L]
Using the NC flag will parse 50% faster:Code:!\.[A-Z]{2,4}$ [NC]
Patterns are essentially prefix matches. In this case the trailing .* pattern is totally redundant. Remove it:Code:RewriteCond %{REQUEST_URI} !^/editors [NC]
DO ensure that your redirects are listed from most-specific to most general, with your general non-www to www redirect listed last. After the redirects, list all the rewrites, again from most-specific to most general. Ensure every RewriteRule is terminated with the [L] flag. Redirects will have [R=301,L] instead.
Last edited by g1smd; 7 Apr 2010 at 10:58 AM.
Here's some hints to make the code much more efficient or correct common errors:
A local OR will parse faster when used in .htaccess. Do also remember to escape periods in patterns:Code:RewriteCond %{HTTP_HOST} ^(www\.)?nautilustorino\.com$
Escape special characters when used in patterns, but NOT in the target URL or filepath. Target URL should not be in quotes. End the domain name with a trailing slash:Code:RewriteRule ^/?$ http://www.edizioninautilus.it/ [R=301,L]
You cannot guarantee module execution order on the server so never mix Redirect and RedirectMatch directives in the same file where RewriteRule is in use. Use RewriteRule for ALL of your redirects and rewrites:If you mix directives, and you have rewrites parsed before redirects, you'll end up exposing server internal filepaths as URLs.Code:RewriteRule "Libri/5000 anni fa - Chiomonte.html" http://www.edizioninautilus.it/5000-anni-fa-chiomonte [R=301,L]
Using the NC flag will parse 50% faster:Code:!\.[A-Z]{2,4}$ [NC]
Patterns are essentially prefix matches. In this case the trailing .* pattern is totally redundant. Remove it:Code:RewriteCond %{REQUEST_URI} !^/editors [NC]
Apply all of the above fixes to every line of code in your .htaccess file. DO ensure that your redirects are listed from most-specific to most general, with your general non-www to www redirect listed last. After the redirects, list all the rewrites, again from most-specific to most general. Ensure every RewriteRule is terminated with the [L] flag. Redirects will have [R=301,L] instead.
Last edited by g1smd; 7 Apr 2010 at 11:05 AM. Reason: Reposted to correct one typo found after timeout of previous post.
Bookmarks