| Author |
|
abhijeet_dighe Newbie

Joined: 20 January 2010
Online Status: Offline Posts: 15
|
| Posted: 21 July 2010 at 6:19am | IP Logged
|
|
|
Hi,
We have multiple sites on our server. All of our sites urls are having "/clients/anyclientname" where anyclientname is same as sitename. and we would like to remove "/clients/anyclientname".
Example URLs:
Current Url: http://site1.com/clients/site1/anypage.htm New Url: http://site1.com/anypage.htm
Current Url:
http://site2.com/clients/site2/anypage.htm
New Url:
http://site2.com/anypage.htm
I dont want to remove any querystring variables.Just keep them as it is. How to remove "/clients/anyclientname" from url?
|
| Back to Top |
|
| |
AndrushkaUS Senior Member

Joined: 13 November 2009 Location: United States
Online Status: Offline Posts: 1545
|
| Posted: 21 July 2010 at 8:48am | IP Logged
|
|
|
Hello,
please, try using the following:
Code:
RewriteEngine on
RewriteBase /
RewriteRule ^clients/[^/]+/(.*)$ $1 [NC,R=301,L]
RewriteCond %{HTTP:HOST} ^([^.])\.com$
RewriteRule ^(?!(?:clients).*)$ clients/%1/$1 [NC,L] |
|
|
Regards
Andrew
__________________ The will to conquer is the first condition of VICTORY
|
| Back to Top |
|
| |
abhijeet_dighe Newbie

Joined: 20 January 2010
Online Status: Offline Posts: 15
|
| Posted: 22 July 2010 at 2:04am | IP Logged
|
|
|
Hi,
Thanks. I will try it out.
I dont have much knowledge about regular expressions. Can you please tell me in brief function of each line given below:
RewriteRule ^clients/[^/]+/(.*)$ $1 [NC,R=301,L]
RewriteCond %{HTTP:HOST} ^([^.])\.com$
RewriteRule ^(?!(?:clients).*)$ clients/%1/$1 [NC,L]
Currently I am using trial version. Is there any difference between functionality of trial and licensed version?
If any issue occurs, how can I turn off ISAPI instead of uninstalling it?
and If I uninstall it, will I have to make any changes to keep my sites working as they were before?
|
| Back to Top |
|
| |
AndrushkaUS Senior Member

Joined: 13 November 2009 Location: United States
Online Status: Offline Posts: 1545
|
| Posted: 23 July 2010 at 3:39am | IP Logged
|
|
|
Explanation:
Code:
| RewriteRule ^clients/[^/]+/(.*)$ $1 [NC,R=301,L] |
|
|
Says take all URLs starting with 'clents', than there will be some folder and then it'll take out the rest - $1, finally redirect to $1.
Code:
| RewriteCond %{HTTP:HOST} ^([^.])\.com$ |
|
|
Takes out the HOST hostname.com
Code:
| RewriteRule ^(?!(?:clients).*)$ clients/%1/$1 [NC,L] |
|
|
Everything that is not starting with clients send to /clients/HOSTname/....
Special limitations of LITE version
Code:
If any issue occurs, how can I turn off ISAPI instead of uninstalling it?
and If I uninstall it, will I have to make any changes to keep my sites working as they were before? |
|
|
There's no obvious issues for me to turn off or uninstall ISAPI_Rewrite. It's flexible and adjustable. We can always help you deal with it.
Regards
Andrew
__________________ The will to conquer is the first condition of VICTORY
|
| Back to Top |
|
| |
abhijeet_dighe Newbie

Joined: 20 January 2010
Online Status: Offline Posts: 15
|
| Posted: 23 July 2010 at 7:09am | IP Logged
|
|
|
Hi,
Thanks for explanation. I tried above rule but it is not working. It redirects but gives message "Page not Found"
I have "clients" folder configured as virtual directory under wwwroot. Under clients folder, there are sub-folders like website1, website2, website3, website4, website5, ...
For example in below link: http://bulletlink-e8.com/clients/bulletlink-e8/this-is-test-p182-1.htm There is bulletlink-e8 sub-folder in clients folder.
Above link gets redirected to the following, but gives "Page not Found" error: http://bulletlink-e8.com/this-is-test-p182-1.htm
|
| Back to Top |
|
| |
abhijeet_dighe Newbie

Joined: 20 January 2010
Online Status: Offline Posts: 15
|
| Posted: 26 July 2010 at 12:59am | IP Logged
|
|
|
Hi,
How to resolve above issue? Is it possible or not?
|
| Back to Top |
|
| |
AndrushkaUS Senior Member

Joined: 13 November 2009 Location: United States
Online Status: Offline Posts: 1545
|
| Posted: 26 July 2010 at 4:13am | IP Logged
|
|
|
Please, provide the rewrite.log for the testing request.
Logging issues described in FAQ.
Regards
Andrew
__________________ The will to conquer is the first condition of VICTORY
|
| Back to Top |
|
| |
abhijeet_dighe Newbie

Joined: 20 January 2010
Online Status: Offline Posts: 15
|
| Posted: 26 July 2010 at 5:12am | IP Logged
|
|
|
Here is rewrite.log:
117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:14 GMT [bulletlink-e8.com/sid#1][rid#20312624/initial] (2) init rewrite engine with requested uri / 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:14 GMT [bulletlink-e8.com/sid#1][rid#20312624/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:14 GMT [bulletlink-e8.com/sid#1][rid#20312624/initial] (1) Htaccess process request c:\inetpub\wwwroot\.htaccess 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:14 GMT [bulletlink-e8.com/sid#1][rid#20312624/initial] (3) applying pattern '^clients/[^/]+/(.*)$' to uri '' 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:14 GMT [bulletlink-e8.com/sid#1][rid#20312624/initial] (3) applying pattern '^(?!(?:clients).*)$' to uri '' 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:14 GMT [bulletlink-e8.com/sid#1][rid#20312624/initial] (4) RewriteCond: input='bulletlink-e8.com' pattern='^([^.])\.com$' => not-matched
117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:15 GMT [bulletlink-e8.com/sid#1][rid#20283320/initial] (2) init rewrite engine with requested uri /bl.js 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:15 GMT [bulletlink-e8.com/sid#1][rid#20283320/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:15 GMT [bulletlink-e8.com/sid#1][rid#20283320/initial] (1) Htaccess process request c:\inetpub\wwwroot\.htaccess 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:15 GMT [bulletlink-e8.com/sid#1][rid#20283320/initial] (3) applying pattern '^clients/[^/]+/(.*)$' to uri 'bl.js' 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:15 GMT [bulletlink-e8.com/sid#1][rid#20283320/initial] (3) applying pattern '^(?!(?:clients).*)$' to uri 'bl.js'
117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:31 GMT [bulletlink-e8.com/sid#1][rid#20327720/initial] (2) init rewrite engine with requested uri /clients/bulletlink-e8/salim-test-p179-1.htm 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:31 GMT [bulletlink-e8.com/sid#1][rid#20327720/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:31 GMT [bulletlink-e8.com/sid#1][rid#20327720/initial] (1) Htaccess process request c:\inetpub\wwwroot\.htaccess 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:31 GMT [bulletlink-e8.com/sid#1][rid#20327720/initial] (3) applying pattern '^clients/[^/]+/(.*)$' to uri 'clients/bulletlink-e8/salim-test-p179-1.htm' 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:31 GMT [bulletlink-e8.com/sid#1][rid#20327720/initial] (1) escaping /salim-test-p179-1.htm 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:31 GMT [bulletlink-e8.com/sid#1][rid#20327720/initial] (2) explicitly forcing redirect with http://bulletlink-e8.com/salim-test-p179-1.htm 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:31 GMT [bulletlink-e8.com/sid#1][rid#20327720/initial] (2) internal redirect with /clients/bulletlink-e8/salim-test-p179-1.htm [INTERNAL REDIRECT]
117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:31 GMT [bulletlink-e8.com/sid#1][rid#20327720/initial] (2) init rewrite engine with requested uri /salim-test-p179-1.htm 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:31 GMT [bulletlink-e8.com/sid#1][rid#20327720/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:31 GMT [bulletlink-e8.com/sid#1][rid#20327720/initial] (1) Htaccess process request c:\inetpub\wwwroot\.htaccess 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:31 GMT [bulletlink-e8.com/sid#1][rid#20327720/initial] (3) applying pattern '^clients/[^/]+/(.*)$' to uri 'salim-test-p179-1.htm' 117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:31 GMT [bulletlink-e8.com/sid#1][rid#20327720/initial] (3) applying pattern '^(?!(?:clients).*)$' to uri 'salim-test-p179-1.htm'
In above log search for "salim-test-p179-1.htm" This htm file is having actual url as: http://bulletlink-e8.com/clients/bulletlink-e8/salim-test-p179-1.htm and I would like it to be displayed as: http://bulletlink-e8.com/salim-test-p179-1.htm It is displayed properly, but gives "page not found" error message.
Note: "clients" folder is configured as virtual directory.
Edited by abhijeet_dighe - 26 July 2010 at 5:30am
|
| Back to Top |
|
| |
AndrushkaUS Senior Member

Joined: 13 November 2009 Location: United States
Online Status: Offline Posts: 1545
|
| Posted: 26 July 2010 at 7:37am | IP Logged
|
|
|
I'd strip the log a little from the third paragraph:
Code:
(2) init rewrite engine with requested uri /clients/bulletlink-e8/salim-test-p179-1.htm
(3) applying pattern '^clients/[^/]+/(.*)$' to uri 'clients/bulletlink-e8/salim-test-p179-1.htm'
(1) escaping /salim-test-p179-1.htm
(2) explicitly forcing redirect with http://bulletlink-e8.com/salim-test-p179-1.htm
(2) internal redirect with /clients/bulletlink-e8/salim-test-p179-1.htm [INTERNAL REDIRECT] |
|
|
As you can see it redirects to /salim-test-p179-1.htm and then rewrites back to /clients/bulletlink-e8/salim-test-p179-1.htm as a source.(As you
wished)
No special rules for clients as a virtual folder is needed.
Make sure the file salim-test-... is really there.
Regards
Andrew
__________________ The will to conquer is the first condition of VICTORY
|
| Back to Top |
|
| |
abhijeet_dighe Newbie

Joined: 20 January 2010
Online Status: Offline Posts: 15
|
| Posted: 27 July 2010 at 6:34am | IP Logged
|
|
|
Hi,
Our actual url is
http://bulletlink-e8.com/clients/bulletlink-e8/salim-test-p179-1.htm.
We have virtual directory called "clients" which
points to the following directories:
g:\MyFiles\bulletlink-e8\salim-test-p179-1.htm
g:\MyFiles\anotherSite1\something-test-p14-4.htm
g:\MyFiles\anotherSite2\something2-test2-p324-6.htm
.......
.......
.......
After applying your rule, when we request
http://bulletlink-e8.com/salim-test-p179-1.htm we get "page not
found" error. Seems like it is pulling file from the root which is
c:\inetpub\wwwroot and of course this file is not there.
Please advice.
Edited by abhijeet_dighe - 27 July 2010 at 6:35am
|
| Back to Top |
|
| |
abhijeet_dighe Newbie

Joined: 20 January 2010
Online Status: Offline Posts: 15
|
| Posted: 27 July 2010 at 11:38pm | IP Logged
|
|
|
Hi,
I think code given is for redirecting.
I dont want to redirect, I just want to hide "/clients/anyclientname".
The location of file "salim-test-p179-1.htm" is not changed. It will be still in "/clients/anyclientname" folder.
Currently user sees long url like this: http://bulletlink-e8.com/clients/bulletlink-e8/salim-test-p179-1.htm and I want to show short url to user like this: http://bulletlink-e8.com/salim-test-p179-1.htm
So how to hide "/clients/anyclientname" in url? clients is virual directory.
1. Is this possible or not? 2. If yes, whats the code for this? 3. If yes, in which folder should I paste this code: wwwroot or clients?
Edited by abhijeet_dighe - 27 July 2010 at 11:38pm
|
| Back to Top |
|
| |
AndrushkaUS Senior Member

Joined: 13 November 2009 Location: United States
Online Status: Offline Posts: 1545
|
| Posted: 28 July 2010 at 2:14am | IP Logged
|
|
|
To hide anything in URL, the scheme would be:
1) redirect 'ugly' link to a 'nice' one (example: /clients/bulletlink-e8/salim-test-p179-1.htm --> /salim-test)
2) after redirect has occurred it rewrites back to 'ugly', so that it will load content from actual link
That's what I wrote for you, and that how it works. First, it transforms the link in browser for user, then it looks for the
content at the source.
What bothered me all the time, is that you haven't pasted all the log.
There're supposed to be more lines after
Code:
117.241.80.155 117.241.80.155 Mon, 26-Jul-2010 04:52:31 GMT [bulletlink-e8.com/sid#1][rid#20327720/initial] (3) applying
pattern '^(?!(?:clients).*)$' to uri 'salim-test-p179-1.htm' |
|
|
That actually shows how the rule is applied and where it's looking for the content.
As long as htaccess is placed here - c:\inetpub\wwwroot\.htaccess, the rules will be applied to the current folder. If the
virtual folder in IIS is set correctly - evrything will work. OR you can modify the rule to go to g:\MyFiles\bulletlink-e8\salim-
test-p179-1.htm directly.
Regards
Andrew
__________________ The will to conquer is the first condition of VICTORY
|
| Back to Top |
|
| |
abhijeet_dighe Newbie

Joined: 20 January 2010
Online Status: Offline Posts: 15
|
| Posted: 28 July 2010 at 8:23am | IP Logged
|
|
|
Hi,
rewrite.log sent at support@helicontech.com.
I just turned on log for 5 minutes and you will see log for site: bulletlink-e8.com
I visited "http://bulletlink-e8.com/" and clicked on "Go to new page" link which had full path like "http://bulletlink-e8.com/clients/bulletlink-e8/test123.htm". It shown short url like "http://bulletlink-e8.com/test123.htm". But "Page not Found" message was shown.
So, I have currently removed rule and turned off log. But you can still visit http://bulletlink-e8.com/ to get more idea.
I have written rule in c:\inetpub\wwwroot\.htaccess
Edited by abhijeet_dighe - 29 July 2010 at 1:10am
|
| Back to Top |
|
| |