phranque

msg:4555270 | 1:40 pm on Mar 15, 2013 (gmt 0) |
welcome to WebmasterWorld, philsoft! what are you requesting? what is your expected result? what was the response? are you trying to do an internal rewrite or a redirect?
|
philsoft

msg:4555276 | 1:59 pm on Mar 15, 2013 (gmt 0) |
think its an internal rewrite? Original code was for domain name only RewriteCond %{HTTP_HOST} !^www\.example\.co\.uk$ RewriteCond %{HTTP_HOST} !^example\.co\.uk$ RewriteRule ^.*$ urls/index.php [L] but mine has domain/subdirectory
|
g1smd

msg:4555277 | 2:08 pm on Mar 15, 2013 (gmt 0) |
Are you trying to redirect requests for one URL so that the user makes a request for a different URL? OR Are you internally rewriting a request such that requesting a particular URL internally fetches content from a different place from inside the server? You need to talk about requests in terms of URLs (including protocol and hostname) and internal paths and filenames (without hostnames).
|
philsoft

msg:4555336 | 3:52 pm on Mar 15, 2013 (gmt 0) |
sorry start again, the Original working code is for a domain name only example: www.example.co.uk/.htaccess RewriteCond %{HTTP_HOST} !^www\.example\.co\.uk$ RewriteCond %{HTTP_HOST} !^example\.co\.uk$ RewriteRule ^.*$ subdirectory1/index.php [L] where subdirectory1/index.php is to the short url script. ======================================================== I have my files and short url script under a subdirectory example: www.example.co.uk/subdirectory/ and so www.example.co.uk/subdirectory/.htaccess I have tried RewriteCond %{HTTP_HOST} !^www\.example\.co\.uk\subdirectory$ RewriteCond %{HTTP_HOST} !^example\.co\.uk\subdirectory$ RewriteRule ^.*$ subdirectory/subdirectory1/index.php [L] where subdirectory/subdirectory1/index.php is to the short url script. ========================================================
|
g1smd

msg:4555343 | 3:58 pm on Mar 15, 2013 (gmt 0) |
OK. You appear to have two internal rewrites. The internal rewrite in the root htaccess file uses the pattern .* and so it matches ALL requests for root URLs and all folder URLs. You need to list your folder URL rule BEFORE the catch-all rule. It needs a "more specific" pattern to capture those requests before the "more general" pattern in the later rule captures them. You cannot have this sub-folder rule in the htaccess file in a sub-folder. The .* pattern in the root htaccess will have already tried to deal with the request. Additionally the HTTP_HOST condition can test only the hostname without protocol and without path or file. The RegEx pattern must include ONLY the hostname (with literal periods escaped of course). The two host conditions simplify to:
RewriteCond %{HTTP_HOST} !^(www\.)?example\.co\.uk\ It's also a mystery why you want the rule to work only when a specific hostname is NOT requested.
|
philsoft

msg:4555352 | 4:10 pm on Mar 15, 2013 (gmt 0) |
Im very new to this? do mean somthing like RewriteEngine On RewriteCond %{REQUEST_URI} !^/subdirectory/ RewriteRule ^.*$ subdirectory/subdirectory1/index.php [L]
|
philsoft

msg:4555355 | 4:16 pm on Mar 15, 2013 (gmt 0) |
It's also a mystery why you want the rule to work only when a specific hostname is NOT requested....... I have two databases/scripts runnung under two subdirectories. www.example.co.uk/subdirectory script1/ www.example.co.uk/subdirectory script2/ if that makes sence... and need
|
philsoft

msg:4555368 | 4:49 pm on Mar 15, 2013 (gmt 0) |
....The internal rewrite in the root htaccess file uses the pattern .* and so it matches ALL requests for root URLs and all folder URLs. Please note, am not using the root htaccess file this was only an example of the working script.....www.example.co.uk/.htaccess RewriteCond %{HTTP_HOST} !^www\.example\.co\.uk$ RewriteCond %{HTTP_HOST} !^example\.co\.uk$ RewriteRule ^.*$ subdirectory1/index.php [L] where subdirectory1/index.php is to the short url script. ======================================================== I need it work under the subdirectory any help please...
|
lucy24

msg:4555471 | 10:43 pm on Mar 15, 2013 (gmt 0) |
Can you go all the way back to the beginning, please? Pretend that you have never heard the words redirect, rewrite, root, host, directory, htaccess et cetera. You are allowed to use the words "address bar" (as in the user's browser) if you need to. Now just explain in English #1 What the user does and #2 What is supposed to happen when they do this. Repeat for each different set of actions. Make up two or more examples for each pattern. It may or may not be helpful to show a few cases of #3 Things the user might do that are OK the way they are and don't need to be changed in any way.
|
|