|
View:
New views
18 Messages
—
Rating Filter:
Alert me
|
|
|
Address rewriting with mod_rewriteI must translate the following address:
http://www.giovannifornero.net/index.php?pagina=home in the more confortable way: http://www.giovannifornero.net I tried to put in .htaccess the string: RewriteRule ^/index.php?pagina=home$ ^giovannifornero.net [R=301,NC,L] but it doesn't happen anything. Is there anything conceptually wrong? Are there some mistakes in syntax? Thanx! MS -- linux user no.: 353546 --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@... " from the digest: users-digest-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Address rewriting with mod_rewriteOn Mon, Oct 6, 2008 at 9:31 AM, Mauro Sacchetto
<mauro.sacchetto@...> wrote: > I must translate the following address: > http://www.giovannifornero.net/index.php?pagina=home > in the more confortable way: > http://www.giovannifornero.net > I tried to put in .htaccess the string: > RewriteRule ^/index.php?pagina=home$ ^giovannifornero.net [R=301,NC,L] > but it doesn't happen anything. > Is there anything conceptually wrong? > Are there some mistakes in syntax? > The query string (after the question mark) isn't part of what you're comparing against. To compare against the query string, precede your rule with Rewritecond %{QUERY_STRING} pagina=home (and remove the query string part. The 2nd parameter of your RewriteRule should be a full URL (host/port/path) or just "/" in this case would work, and should not have any regex characters like "^" in it. -- Eric Covener covener@... --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@... " from the digest: users-digest-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Address rewriting with mod_rewriteOn Mon, Oct 6, 2008 at 3:31 PM, Mauro Sacchetto
<mauro.sacchetto@...> wrote: > I must translate the following address: > http://www.giovannifornero.net/index.php?pagina=home > in the more confortable way: > http://www.giovannifornero.net > I tried to put in .htaccess the string: > RewriteRule ^/index.php?pagina=home$ ^giovannifornero.net [R=301,NC,L] > but it doesn't happen anything. > Is there anything conceptually wrong? > Are there some mistakes in syntax? In what direction do you want the rewrite to happen? Let me guess: You want the user to be able to enter the following in the address bar in his browser: http://www.giovannifornero.net and the webserver should then answer with the same content as if the user had entered: http://www.giovannifornero.net/index.php?pagina=home Am I correct? In this case you just have you rewrite the wrong way around. You are trying to rewrite A -> B whereas you need to rewrite B -> A Doing this in .htaccess files is possible with a rewrite, but this might not be the best way. If you want visitors to your site to start at /index.php?pagina=home than the following might work better: DirectoryIndex /index.php?pagina=home Krist -- krist.vanbesien@... krist@... Bremgarten b. Bern, Switzerland -- A: It reverses the normal flow of conversation. Q: What's wrong with top-posting? A: Top-posting. Q: What's the biggest scourge on plain text email discussions? --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@... " from the digest: users-digest-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Address rewriting with mod_rewriteIl lunedì 6 ottobre 2008 15:56:23 Krist van Besien ha scritto:
> In what direction do you want the rewrite to happen? > Let me guess: You want the user to be able to enter the following in > the address bar in his browser: > http://www.giovannifornero.net > and the webserver should then answer with the same content as if the > user had entered: > http://www.giovannifornero.net/index.php?pagina=home > Am I correct? Yes! > In this case you just have you rewrite the wrong way around. You are > trying to rewrite A -> B whereas you need to rewrite B -> A The corrected string RewriteRule ^giovannifornero.net$ /index.php?pagina=home$ [R=301,NC,L] doesn't work in any case... > Doing this in .htaccess files is possible with a rewrite, but this > might not be the best way. If you want visitors to your site to start > at /index.php?pagina=home than the following might work better: > DirectoryIndex /index.php?pagina=home I describe you the situation. I start with the address: http://www.giovannifornero.net. I change page, After, I come back to home using the menu. Ths time, the address is: http://www.giovannifornero.net/index.php?pagina=home I'd like the address was in any case http://www.giovannifornero.net. Thanx MS -- linux user no.: 353546 --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@... " from the digest: users-digest-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Address rewriting with mod_rewriteIl lunedì 6 ottobre 2008 15:55:33 Eric Covener ha scritto:
> The query string (after the question mark) isn't part of what you're > comparing against. To compare against the query string, precede your > rule with > Rewritecond %{QUERY_STRING} pagina=home (and remove the query string part. > The 2nd parameter of your RewriteRule should be a full URL > (host/port/path) or just "/" in this case would work, and should not > have any regex characters like "^" in it. I tried this whole address string: RewriteRule http://www.giovannifornero.net/index.php?pagina=home$ http://www.giovannifornero.net [R=301,NC,L] but even this time it doesn't work... Has it some mistakes? Thanx! MS -- linux user no.: 353546 --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@... " from the digest: users-digest-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Address rewriting with mod_rewriteIl lunedì 6 ottobre 2008 15:56:23 Krist van Besien ha scritto:
> In what direction do you want the rewrite to happen? > Let me guess: You want the user to be able to enter the following in > the address bar in his browser: > http://www.giovannifornero.net > and the webserver should then answer with the same content as if the > user had entered: > http://www.giovannifornero.net/index.php?pagina=home > Am I correct? Yes! > In this case you just have you rewrite the wrong way around. You are > trying to rewrite A -> B whereas you need to rewrite B -> A The corrected string RewriteRule ^giovannifornero.net$ /index.php?pagina=home$ [R=301,NC,L] doesn't work in any case... > Doing this in .htaccess files is possible with a rewrite, but this > might not be the best way. If you want visitors to your site to start > at /index.php?pagina=home than the following might work better: > DirectoryIndex /index.php?pagina=home I describe you the situation. I start with the address: http://www.giovannifornero.net. I change page, After, I come back to home using the menu. Ths time, the address is: http://www.giovannifornero.net/index.php?pagina=home I'd like the address was in any case http://www.giovannifornero.net. Thanx MS -- linux user no.: 353546 --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@... " from the digest: users-digest-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Address rewriting with mod_rewriteOn Mon, Oct 6, 2008 at 12:18 PM, Mauro Sacchetto
<mauro.sacchetto@...> wrote: > Il lunedì 6 ottobre 2008 15:55:33 Eric Covener ha scritto: >> The query string (after the question mark) isn't part of what you're >> comparing against. To compare against the query string, precede your >> rule with >> Rewritecond %{QUERY_STRING} pagina=home (and remove the query string part. >> The 2nd parameter of your RewriteRule should be a full URL >> (host/port/path) or just "/" in this case would work, and should not >> have any regex characters like "^" in it. > > I tried this whole address string: > RewriteRule http://www.giovannifornero.net/index.php?pagina=home$ > http://www.giovannifornero.net [R=301,NC,L] None of the examples in the manual match against the protocol or hostname part of the URL. I previously described that you also can't match the query string in the rewriterule. You also probably need a trailing slash on the 2nd argument. Note that this rule redirects from the index.php page _to_ the "/" page which seems to be the opposite of what you want. -- Eric Covener covener@... --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@... " from the digest: users-digest-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Address rewriting with mod_rewriteIl lunedì 6 ottobre 2008 19:14:02 hai scritto:
> None of the examples in the manual match against the protocol or > hostname part of the URL. > I previously described that you also can't match the query string in > the rewriterule. > You also probably need a trailing slash on the 2nd argument. > Note that this rule redirects from the index.php page _to_ the "/" > page which seems to be the opposite of what you want. To optimize the page for search motors, I neet to have always a (pseudo)-static address in home. But I proceed for trials & errors (moreover errors...). So I tried this (still not working): Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^giovannifornero.net [NC] RewriteRule (.*) http://www.giovannifornero.net/$1 [L,R=301] RewriteCond %{QUERY_STRING} pagina=home RewriteRule ^$ http://www.giovannifornero.net [R=301,L] I think more other syntactical mistakes... Thax a lot MS -- linux user no.: 353546 --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@... " from the digest: users-digest-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Address rewriting with mod_rewriteOn 10/6/08, Mauro Sacchetto <mauro.sacchetto@...> wrote:
> Il lunedì 6 ottobre 2008 19:14:02 hai scritto: > > > None of the examples in the manual match against the protocol or > > hostname part of the URL. > > I previously described that you also can't match the query string in > > the rewriterule. > > You also probably need a trailing slash on the 2nd argument. > > Note that this rule redirects from the index.php page _to_ the "/" > > page which seems to be the opposite of what you want. > > To optimize the page for search motors, I neet to have always > a (pseudo)-static address in home. But I proceed for trials & errors > (moreover errors...). So I tried this (still not working): > > Options +FollowSymLinks > RewriteEngine on > RewriteCond %{HTTP_HOST} ^example.net [NC] > RewriteRule (.*) http://www.example.net/$1 [L,R=301] > RewriteCond %{QUERY_STRING} pagina=home > RewriteRule ^$ http://www.example.net [R=301,L] > > I think more other syntactical mistakes... > Thax a lot > MS The second rewrite redirects requests with the querystring "?pagina=home" to the homepage. To check querystrings with multiple parameters: RewriteCond %{QUERY_STRING} ^(.*&)*pagina=home(&)? RewriteRule (*.) / [P] You seem to have the very common goal of having the homepage appear for / even though your internal URL for the homepage includes extra text. RewriteRule ^/$ /index.php?pagina=home [P] (From other posts) After, I come back to home using the menu, the address is: http://www.example.net/index.php?pagina=home I'd like the address to be http://www.example.net/ You also want the any links to the homepage in your application to use href="/" rather than href="/index.php?pagina=home". The application creates those links. The code generating the menus includes the link to: http://www.example.net/index.php?pagina=home This cannot be fixed with basic Apache httpd; you should correct your menus in the application. (mod_proxy_html might help if you get it to work.) HTH, solprovider |
|
|
Re: Address rewriting with mod_rewriteIl martedì 7 ottobre 2008 08:21:04 solprovider@... ha scritto:
> The second rewrite redirects requests with the querystring > "?pagina=home" to the homepage. To check querystrings with multiple > parameters: > RewriteCond %{QUERY_STRING} ^(.*&)*pagina=home(&)? > RewriteRule (*.) / [P] If I put this tring, in my .htconfig, I obtain only: Code 500 > Policy violation or wrong htaccess! > You also want the any links to the homepage in your application to use > href="/" rather than href="/index.php?pagina=home". The application > creates those links. The code generating the menus includes the link > to: > http://www.example.net/index.php?pagina=home > This cannot be fixed with basic Apache httpd; you should correct your > menus in the application. (mod_proxy_html might help if you get it to > work.) I never considered such a thing, so I'll try to study some documentation about it... Thanx! MS -- linux user no.: 353546 --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@... " from the digest: users-digest-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Address rewriting with mod_rewriteIl martedì 7 ottobre 2008 08:21:04 solprovider@... ha scritto:
> This cannot be fixed with basic Apache httpd; you should correct your > menus in the application. (mod_proxy_html might help if you get it to > work.) Consider that I use an external host, so I cannot work on its Apache configuration. Or there is a trick for PHP, or .htaccess. I don't know if there is a further way to solve... Thanx MS -- linux user no.: 353546 --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@... " from the digest: users-digest-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Address rewriting with mod_rewriteOn Tue, Oct 7, 2008 at 3:10 PM, Mauro Sacchetto
<mauro.sacchetto@...> wrote: > Il martedì 7 ottobre 2008 08:21:04 solprovider@... ha scritto: >> The second rewrite redirects requests with the querystring >> "?pagina=home" to the homepage. To check querystrings with multiple >> parameters: >> RewriteCond %{QUERY_STRING} ^(.*&)*pagina=home(&)? >> RewriteRule (*.) / [P] > If I put this tring, in my .htconfig, I obtain only: > > Code 500 > Policy violation or wrong htaccess! You really need to think about, what you are trying to do, and try to understand how http work. What you tried to do above will not have the effect you want. So it is usueless to try to make it work. What you have to understand is that RewriteRules operate on the requests that are sent from the browser to the server, not the other way round. So what you can do with a rewrite rule is make it possible for a browser to request A, and get B in stead. I think you obviously want to hide the "index.php?pagina=home" from the user. So what you want is that when a user requests http://www.giovannifornero.net/ het gets http://www.giovannifornero.net/index.php?pagina=home but the address bar in the browser does remain "http://www.giovannifornero.net/" This means that you need to convert a request for "/" in to a request for "index.php?pagina=home", not the other way round. And this looks like this: RewriteRule ^/$ /index.php?pagina=home [P] This is btw what solprovider already suggested, so try this out. Ofcourse, this is not the end. You might have to look at the links that are in the page that index.php generates... Is this by any chance a CMS you've installed? If so, which one? Krist -- krist.vanbesien@... krist@... Bremgarten b. Bern, Switzerland -- A: It reverses the normal flow of conversation. Q: What's wrong with top-posting? A: Top-posting. Q: What's the biggest scourge on plain text email discussions? --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@... " from the digest: users-digest-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Address rewriting with mod_rewriteOn Tue, Oct 7, 2008 at 3:14 PM, Mauro Sacchetto
<mauro.sacchetto@...> wrote: > Il martedì 7 ottobre 2008 08:21:04 solprovider@... ha scritto: >> This cannot be fixed with basic Apache httpd; you should correct your >> menus in the application. (mod_proxy_html might help if you get it to >> work.) > > Consider that I use an external host, so I cannot > work on its Apache configuration. Or there is a trick > for PHP, or .htaccess. I don't know if there is > a further way to solve... If I go to http://www.giovannifornero.net/ I see that I get the startpage. So you got it working, right? Krist -- krist.vanbesien@... krist@... Bremgarten b. Bern, Switzerland -- A: It reverses the normal flow of conversation. Q: What's wrong with top-posting? A: Top-posting. Q: What's the biggest scourge on plain text email discussions? --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@... " from the digest: users-digest-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Address rewriting with mod_rewriteIl martedì 7 ottobre 2008 16:41:50 Krist van Besien ha scritto:
> What you have to understand is that RewriteRules operate on the > requests that are sent from the browser to the server, not the other > way round. > So what you can do with a rewrite rule is make it possible for a > browser to request A, and get B in stead. Thinking and reading more about... > I think you obviously want to hide the "index.php?pagina=home" from > the user. So what you want is that when a user requests > http://www.giovannifornero.net/ > het gets > http://www.giovannifornero.net/index.php?pagina=home > but the address bar in the browser does remain > "http://www.giovannifornero.net/" Yes. This happen if I start from http://www.giovannifornero.net, go in another page abd come back ho home clicking non the "Home" voice on the menu bar. This time I obtain the long PHP address. > Ofcourse, this is not the end. You might have to look at the links > that are in the page that index.php generates... Not easy for me... Just learning... > Is this by any chance a CMS you've installed? If so, which one? No, it's a little site create by myself Thanx MS -- linux user no.: 353546 --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@... " from the digest: users-digest-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Address rewriting with mod_rewriteOn 10/7/08, Mauro Sacchetto <mauro.sacchetto@...> wrote:
> Il martedì 7 ottobre 2008 16:41:50 Krist van Besien ha scritto: > > Ofcourse, this is not the end. You might have to look at the links > > that are in the page that index.php generates... > Not easy for me... Just learning... > > > Is this by any chance a CMS you've installed? If so, which one? > No, it's a little site create by myself > Thanx > MS If the menus are not being generated, they are just HTML files (or PHP files including static HTML for menus.) Just change the links for the homepage to the now-working URL: <a href="/index.php?pagina=home">Home</a> Becomes: <a href="/">Home</a> The new links will only work through Apache httpd. Directly accessing the application server will error for these links. solprovider |
|
|
Re: Address rewriting with mod_rewriteIl martedì 7 ottobre 2008 17:29:36 hai scritto:
> If the menus are not being generated, they are just HTML files (or PHP > files including static HTML for menus.) Just change the links for the > homepage to the now-working URL: > <a href="/index.php?pagina=home">Home</a> > Becomes: > <a href="/">Home</a> > The new links will only work through Apache httpd. Directly accessing > the application server will error for these links. The menus are dinamically generated by PHP... MS -- linux user no.: 353546 -- Prof. Mauro Sacchetto Santa Croce 1332a 30135 VENEZIA tel.: 041 5226494 cell.: 320 7414579 348 9690575 e-mail: mauro.sacchetto@... mauro.sacchetto@... linux user no.: 353546 --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@... " from the digest: users-digest-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Address rewriting with mod_rewriteOn Tue, Oct 7, 2008 at 4:59 PM, Mauro Sacchetto
<mauro.sacchetto@...> wrote: > Yes. This happen if I start from http://www.giovannifornero.net, > go in another page abd come back ho home clicking > non the "Home" voice on the menu bar. This time > I obtain the long PHP address. That is because the link you click on contains the long addres. Rewrites do not affect the content of the response. You will need to change the code that generates the menu to use the short address for the "home" button. Krist -- krist.vanbesien@... krist@... Bremgarten b. Bern, Switzerland -- A: It reverses the normal flow of conversation. Q: What's wrong with top-posting? A: Top-posting. Q: What's the biggest scourge on plain text email discussions? --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more inf |