|
Home > Archive > Apache Server configuration support > January 2007 > RewriteRule and url not hidden
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
RewriteRule and url not hidden
|
|
|
|
| Jim Hayter 2007-01-19, 1:19 pm |
| Giacomo wrote:
> Hi everybody,
> in my .htaccess file I do have this code:
>
> RewriteBase /
> RewriteCond %{HTTP_HOST} !^community\.
> RewriteCond %{HTTP_HOST} !^recensioni\.
> RewriteCond %{HTTP_HOST} !^www\.
> RewriteCond %{HTTP_HOST} ^([^.]+)\.dominio\.it
> RewriteRule ^(.*)$ http://community.dominio.it/dir/index/%1.html [L]
>
> It works, but in the web address bar I see the new address
> (http://community.dominio.it/dir/index/%1.html) instead of old address
> (http://nome.dominio.it)
>
> Do you know why? I would like to hide the new url.
>
> Bye and thanks
>
Short answer - you can't. If you were doing an internal redirect, you
could hide it. You are doing an external redirect by specifying a
different host. If you want to hide this you can look at implementing
proxy access to community.dominio.it within apache.
HTH,
Jim
| |
| Giacomo 2007-01-20, 7:23 am |
| Jim Hayter ha scritto:
> Short answer - you can't. If you were doing an internal redirect, you
> could hide it. You are doing an external redirect by specifying a
> different host. If you want to hide this you can look at implementing
> proxy access to community.dominio.it within apache.
The redirect is done to another internal url.
Anyway this is my problem:
the url is: http://community.domain.it
I would like that any request like "http://variable.domain.it" is passed
(hidden) to "http://community.domain.it/dir/..."
Is it possible?
Actually I created this virtual host:
<VirtualHost *:80>
ServerName community.domain.it
ServerAlias www.community.domain.it
ServerAlias *.domain.it
DocumentRoot /var/www/community
<Directory /var/www/community>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
And the file .htaccess of the "/var/www/community" dir is:
RewriteCond %{HTTP_HOST} !^community\.
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.it
RewriteRule ^(.*)$ http://community.domain.it/dir/.../%1.html[L]
--
Giacomo
| |
|
| Giacomo wrote:
> Jim Hayter ha scritto:
>
> The redirect is done to another internal url.
Then the redirect indeed should be internal
> Anyway this is my problem:
>
> the url is: http://community.domain.it
>
> I would like that any request like "http://variable.domain.it" is
> passed (hidden) to "http://community.domain.it/dir/..."
>
> Is it possible?
>
> Actually I created this virtual host:
>
> <VirtualHost *:80>
> ServerName community.domain.it
> ServerAlias www.community.domain.it
> ServerAlias *.domain.it
Check, wildcard set, that helps :-)
>
> DocumentRoot /var/www/community
> <Directory /var/www/community>
> Options Indexes FollowSymLinks MultiViews
> AllowOverride All
> Order allow,deny
> allow from all
> </Directory>
> </VirtualHost>
> And the file .htaccess of the "/var/www/community" dir is:
> RewriteCond %{HTTP_HOST} !^community\.
> RewriteCond %{HTTP_HOST} !^www\.
> RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.it
> RewriteRule ^(.*)$ http://community.domain.it/dir/.../%1.html[L]
RewriteRule ^(.*)$ /dir/index/%1.html [QSA]
What are you going to do with the capture of $1? (^(.*)$)? In other words:
what shouls http://variable.domain.it/something do with 'something'?
--
Rik Wasmus
| |
| Giacomo 2007-01-20, 1:18 pm |
| Rik ha scritto:
> RewriteRule ^(.*)$ /dir/index/%1.html [QSA]
I tried, but i get an apache internal error. The log tells:
mod_rewrite: maximum number of internal redirects reached. Assuming
configuration error. Use 'RewriteOptions MaxRedirects' to increase the
limit if neccessary.
> What are you going to do with the capture of $1? (^(.*)$)? In other words:
> what shouls http://variable.domain.it/something do with 'something'?
The url:
http://variable.domain.it
should forward to:
http://community.domain.it/dir/index/%1.html
| |
|
|
| Giacomo 2007-01-20, 1:18 pm |
| Rik ha scritto:
> Ooops, add:
> RewriteCond %{REQUEST_FILENAME} !^/dir/index/
> RewriteRule ^(.*)$ /dir/index/%1.html [L,QSA]
Nothing...=(
I write all .htaccess file, maybe the problem is before:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^/dir/index/
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteCond %{HTTP_HOST} !^community\.
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^([^.]+)\.dominio\.it
RewriteCond %{REQUEST_FILENAME} !^/dir/index/
RewriteRule ^(.*)$ /dir/index/%1.html [L,QSA]
> I assume http://community.domain.it/dir/index/variable.html
>
> I know that, what should the url http://variable.domain.it/something do?
> Just forget ebout the 'something' path and just go to
> http://community.domain.it/dir/index/variable.html?
The "http://variable.domain.it/something" url should show output to user.
--
Giacomo
| |
| Ricardo Manuel Oliveira 2007-01-21, 7:23 pm |
| Giacomo,
Giacomo wrote:
> Hi everybody,
> in my .htaccess file I do have this code:
>
> RewriteBase /
> RewriteCond %{HTTP_HOST} !^community\.
> RewriteCond %{HTTP_HOST} !^recensioni\.
> RewriteCond %{HTTP_HOST} !^www\.
> RewriteCond %{HTTP_HOST} ^([^.]+)\.dominio\.it
> RewriteRule ^(.*)$ http://community.dominio.it/dir/index/%1.html [L]
The easiest way around: change your RewriteRule so that, instead of
isuing an external redirect, it uses Apache's mod_proxy to fetch the
URL and send it to the client.
A short example:
RewriteRule ^(.*)$ http://community.dominio.it/index/%1.html [P,L]
Be advised that all requests to will appear to be coming from your
webserver's own IP address, because the requests are, in fact,
requested by mod_proxy.
Regards,
Ricardo Oliveira
http://apache.superbofh.org/ - Apache book in Portuguese
| |
| Giacomo 2007-01-21, 7:23 pm |
| Ricardo Manuel Oliveira ha scritto:
> The easiest way around: change your RewriteRule so that, instead of
> isuing an external redirect, it uses Apache's mod_proxy to fetch the
> URL and send it to the client.
>
> A short example:
>
> RewriteRule ^(.*)$ http://community.dominio.it/index/%1.html [P,L]
>
> Be advised that all requests to will appear to be coming from your
> webserver's own IP address, because the requests are, in fact,
> requested by mod_proxy.
I get an HTML "not found" error, and I get an apache error:
Attempt to serve directory: proxy:http//...
Even if the page exists...=(
--
Giacomo
| |
| Giacomo 2007-01-23, 1:26 pm |
| Giacomo ha scritto:
> Ricardo Manuel Oliveira ha scritto:
>
> I get an HTML "not found" error, and I get an apache error:
> Attempt to serve directory: proxy:http//...
>
> Even if the page exists...=(
Maybe the problem is that I don't have the proxy module loaded?
--
Giacomo
| |
| Ricardo Manuel Oliveira 2007-01-28, 7:23 pm |
|
> The easiest way around: change your RewriteRule so that, instead of
>isuing an external redirect, it uses Apache's mod_proxy to fetch the
>URL and send it to the client.
Apparently, you don't have mod_proxy loaded....
Regards,
Ricardo Oliveira
http://apache.weblog.com.pt/
|
|
|
|
|