HostNed Community

WEB HOSTING DISCUSSIONS => Linux Hosting => Topic started by: Daniel on November 30, 2007, 11:37:58 AM

Title: .htaccess
Post by: Daniel on November 30, 2007, 11:37:58 AM
I was wondering if the ReWriteEngine was active. The following lines don't seem to be working as expected
(redirecting people trying to access

http://mydomain.com/imprimir/tabla-romanos.pdf

to

http://mydomain.com/imprimir/numeros-romanos.html

and so on.
)

Options -Indexes
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule tabla-romanos.pdf$ http://mydomain.com/imprimir/numeros-romanos.html [R,L]

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule tablas-de-multiplicar.pdf$ http://mydomain.com/logo/tablas-de-multiplicar.html [R,L]

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule ejercicios-multiplicacion.pdf$ http://mydomain.com/imprimir/ejercicios-multiplicacion.html [R,L]
Title: Re: .htaccess
Post by: Dynaweb on November 30, 2007, 01:35:32 PM
Which server is your site on?
Title: Re: .htaccess
Post by: Daniel on November 30, 2007, 09:52:42 PM
Quote from: Dynaweb on November 30, 2007, 01:35:32 PM
Which server is your site on?

70.84.212.26
Title: Re: .htaccess
Post by: Dynaweb on December 01, 2007, 03:26:53 AM
Mod_rewrite is active and functional on that server.  Are the rules you have active axactly as you posted here or is that just a generic example?
Title: Re: .htaccess
Post by: Daniel on December 01, 2007, 08:24:06 AM
Quote from: Dynaweb on December 01, 2007, 03:26:53 AM
Mod_rewrite is active and functional on that server.  Are the rules you have active axactly as you posted here or is that just a generic example?

Currently no,

they are:

RewriteEngine on
Options -Indexes

RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com$      [NC]
RewriteRule .*\.(pdf)$ http://mydomain.com/imprimir/ [R,NC]


But I prefer to have the ones I posted in my first post, because they are specific. They didn't work.
Title: Re: .htaccess
Post by: Daniel on December 01, 2007, 08:25:48 AM
Quote from: Dynaweb on December 01, 2007, 03:26:53 AM
Are the rules you have active axactly as you posted here or is that just a generic example?

the only difference is that I use the actual name of my domain.
Title: Re: .htaccess
Post by: shellnil on December 04, 2007, 12:27:44 PM
Hello,

I have checked the rules provided by you. Can I get the URL where you are getting error and the errors. Also I want to complete rules with real domain name so that I'll investigate the issue further.

Thank You.
Title: Re: .htaccess
Post by: Daniel on December 04, 2007, 08:04:41 PM
Yes, I guess there isn't any problem with publishing that information, the actual file is:


RewriteEngine on
Options -Indexes

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?neoparaiso.com/.*$ [NC]
RewriteRule ejercicios-multiplicacion.pdf$ http://neoparaiso.com/imprimir/ejercicios-multiplicacion.html [R,L]

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?neoparaiso.com/.*$ [NC]
RewriteRule tabla-romanos.pdf$ http://neoparaiso.com/imprimir/numeros-romanos.html [R,L]

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?neoparaiso.com/.*$ [NC]
RewriteRule tablas-de-multiplicar.pdf$ http://neoparaiso.com/logo/tablas-de-multiplicar.html [R,L]




the problem is that, using those rules, when I type in the address bar of the browser something like:


http://neoparaiso.com/logo/tablas-de-multiplicar.pdf

The browser downloads the pdf instead of redirecting to the

http://neoparaiso.com/logo/tablas-de-multiplicar.html