 |
|
 |
|
Next: .httacess and Apache
|
| Author |
Message |
External

Since: Jan 07, 2007 Posts: 3
|
(Msg. 1) Posted: Sun Jan 07, 2007 12:29 pm
Post subject: Rewrite URI with query string, somewhat recursive Archived from groups: alt>apache>configuration (more info?)
|
|
|
Hello list,
I'd like to rewrite /index.php?id=tutorials so that it goes to
/tutorials. Further, /tutorials should then rewrite so that
/index.php?id=tutorials loads 'behind the scenes' (ie, /tutorials is
the canonical URL).
Here are my rules from httpd.conf. Right now, loading
/index.php?id=tutorials redirects to /index.php/ (no idea why). Note
that commenting out the last two rules has no effect. Currently,
rewriting /tutorials to index.php?id=tutorials seems to work; but I
need to go the opposite way too.
Thanks,
Brett
RewriteEngine on
# index.php?id=tutorials should go to /tutorials <-- support old
bookmarks
RewriteCond %{QUERY_STRING} ^id=tutorials$
RewriteRule ^index\.php$ /tutorials? [R]
# tutorials (with no slash) then goes to tutorials/
#RewriteRule ^/tutorials$ /tutorials/ [R]
# tutorials/ (with slash) should load the tutorial index
#RewriteRule ^/tutorials/$ /index.php?id=tutorials [L] >> Stay informed about: Rewrite URI with query string, somewhat recursive |
|
| Back to top |
|
 |  |
External

Since: Jan 07, 2007 Posts: 3
|
(Msg. 2) Posted: Sun Jan 07, 2007 1:24 pm
Post subject: Re: Rewrite URI with query string, somewhat recursive [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
One other note: there exists a directory /tutorials for this server,
but it's being used to serve included content (it's not accessible
directly). Not sure if this is a problem, since the rewrite to
/tutorials (with index.php?id=tutorials loading in the background)
seems to work fine. But perhaps this directory should be renamed,
moved, or made inaccessible.
Brett
On Jan 7, 3:29 pm, "therearenoteams" <therearenote....DeleteThis@gmail.com> wrote:
> Hello list,
>
> I'd like to rewrite /index.php?id=tutorials so that it goes to
> /tutorials. Further, /tutorials should then rewrite so that
> /index.php?id=tutorials loads 'behind the scenes' (ie, /tutorials is
> the canonical URL).
>
> Here are my rules from httpd.conf. Right now, loading
> /index.php?id=tutorials redirects to /index.php/ (no idea why). Note
> that commenting out the last two rules has no effect. Currently,
> rewriting /tutorials to index.php?id=tutorials seems to work; but I
> need to go the opposite way too.
>
> Thanks,
>
> Brett
>
> RewriteEngine on
>
> # index.php?id=tutorials should go to /tutorials <-- support old
> bookmarks
> RewriteCond %{QUERY_STRING} ^id=tutorials$
> RewriteRule ^index\.php$ /tutorials? [R]
>
> # tutorials (with no slash) then goes to tutorials/
> #RewriteRule ^/tutorials$ /tutorials/ [R]
>
> # tutorials/ (with slash) should load the tutorial index
> #RewriteRule ^/tutorials/$ /index.php?id=tutorials [L] >> Stay informed about: Rewrite URI with query string, somewhat recursive |
|
| Back to top |
|
 |  |
External

Since: Jan 07, 2007 Posts: 3
|
(Msg. 3) Posted: Mon Jan 08, 2007 11:41 am
Post subject: Re: Rewrite URI with query string, somewhat recursive [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
The following seems to work. Not much different except the order; a
slash before index.php; and the fact that this is all in httpd.conf,
not an .htaccess
# tutorials (sans slash) so go to tutorials/
RewriteRule ^/tutorials$ /tutorials/ [R]
# tutorials/ (with slash) should load the tutorial index
RewriteRule ^/tutorials/$ /index.php?id=tutorials [L]
# index.php?id=tutorials should go to /tutorials/ <-- support old
bookmarks
RewriteCond %{QUERY_STRING} ^id=tutorials$
RewriteRule ^/index.php$ /tutorials? [R]
On Jan 7, 3:29 pm, "therearenoteams" <therearenote... DeleteThis @gmail.com> wrote:
> Hello list,
>
> I'd like to rewrite /index.php?id=tutorials so that it goes to
> /tutorials. Further, /tutorials should then rewrite so that
> /index.php?id=tutorials loads 'behind the scenes' (ie, /tutorials is
> the canonical URL).
>
> Here are my rules from httpd.conf. Right now, loading
> /index.php?id=tutorials redirects to /index.php/ (no idea why). Note
> that commenting out the last two rules has no effect. Currently,
> rewriting /tutorials to index.php?id=tutorials seems to work; but I
> need to go the opposite way too.
>
> Thanks,
>
> Brett
>
> RewriteEngine on
>
> # index.php?id=tutorials should go to /tutorials <-- support old
> bookmarks
> RewriteCond %{QUERY_STRING} ^id=tutorials$
> RewriteRule ^index\.php$ /tutorials? [R]
>
> # tutorials (with no slash) then goes to tutorials/
> #RewriteRule ^/tutorials$ /tutorials/ [R]
>
> # tutorials/ (with slash) should load the tutorial index
> #RewriteRule ^/tutorials/$ /index.php?id=tutorials [L] >> Stay informed about: Rewrite URI with query string, somewhat recursive |
|
| Back to top |
|
 |  |
External

Since: Jun 06, 2006 Posts: 4
|
(Msg. 4) Posted: Tue Jan 09, 2007 6:17 am
Post subject: Re: Rewrite URI with query string, somewhat recursive [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Honestly, this is more of a PHP question than Apache. Try to hit up the
PHP newsgroup instead for this sort of thing.
Harlin Seritt
therearenoteams wrote:
> Hello list,
>
> I'd like to rewrite /index.php?id=tutorials so that it goes to
> /tutorials. Further, /tutorials should then rewrite so that
> /index.php?id=tutorials loads 'behind the scenes' (ie, /tutorials is
> the canonical URL).
>
> Here are my rules from httpd.conf. Right now, loading
> /index.php?id=tutorials redirects to /index.php/ (no idea why). Note
> that commenting out the last two rules has no effect. Currently,
> rewriting /tutorials to index.php?id=tutorials seems to work; but I
> need to go the opposite way too.
>
> Thanks,
>
> Brett
>
> RewriteEngine on
>
> # index.php?id=tutorials should go to /tutorials <-- support old
> bookmarks
> RewriteCond %{QUERY_STRING} ^id=tutorials$
> RewriteRule ^index\.php$ /tutorials? [R]
>
> # tutorials (with no slash) then goes to tutorials/
> #RewriteRule ^/tutorials$ /tutorials/ [R]
>
> # tutorials/ (with slash) should load the tutorial index
> #RewriteRule ^/tutorials/$ /index.php?id=tutorials [L] >> Stay informed about: Rewrite URI with query string, somewhat recursive |
|
| Back to top |
|
 |  |
| Related Topics: | Not Getting Query String - Hello i have apache server.I am executing my cgi as follows http://myserver.com/mynew.cgi?<HTTP%20dipsachin><get%20dipsachin> i would expect to get <HTTP%20dipsachin><get%20dipsachin> in my script variable currently i am gettin...
mod_rewrite: how to remove an empty parameter from a query.. - hello, after searching desperately for many hours, I decided to ask for help. I hope somebody can point me to the right direction. I have a URI with a query like: http://example.com/page.html?&L= or http://example.com/index.php?id=1&L=&pid...
Mod Rewrite fails with % in string - Any idea why I can't tell mod_rewrite to accept a % character in a string? My regexp looks like: ([a-zA-Z0-9_\%-'!&]*) works great until I put in a % Any ideas?
edcode URL string? - Dear all, I have an Apache server connecting to a Tomcat server running serlvets. The URL is something like http://myserver.domain/App/servlet/pack.test.MyServlet?Flag=Login¶=A. Now, is there any method to encrypt my parameters such that ...
problems with PHP URL string - Hi guys, not quite sure whether this is an Apache setting problem or PHP, but I hoped I would find soebody who can help me with this one. Since updating PHP on my machine to php 4.33 (on Apache HTTP Server Version 1.33) my server does not seem to.. |
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
 |
|
|