httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Warwick" <mwarw...@stwgtn.co.nz>
Subject RE: [users@httpd] Simple URL redirection (mod_rewrite)
Date Sun, 08 Sep 2002 21:30:39 GMT
Sorry about the delay in replying - long weekend.

Either httpd.conf or .htaccess.
The .htaccess will only work if the httpd.conf is set up to allow
overrides in the directory concerned.

The apache part of the solution means setting the directives:
Options +multiviews
(allows you to not have the extension in the filename)
AcceptPathInfo On
(passes the rest of the path after the actual filename onto the PHP
script)

The PHP part of the solution means using the $PATH_INFO to get the path
after the filename.

-----Original Message-----
From: Iván Vega Rivera [mailto:ivan@i-sol.biz]
Sent: Thursday, 5 September 2002 10:51 a.m.
To: users@httpd.apache.org
Subject: RE: [users@httpd] Simple URL redirection (mod_rewrite)


Thanks for your reply.

Your approach doesn't seem to work, as I still get a 404. If I do this
instead:

RewriteEngine on
RewriteBase /somedir/help
RewriteRule ^(.*)$ index.php?on=$1

I get something... But not what I want. On that example, index.php does
get called, but the "on" variable is not set to the path that is after
/somedir/help, but "index.php" instead, as print_r outputs:

$_GET: Array ( [on] => index.php )

So... It appears we're getting close.

Now, can you give me more info on your alternate method? Does that
method need you to have access to httpd.conf?

Thanks again.

Sincerely,
Ivan V.

-----Mensaje original-----
De: Michael Warwick [mailto:mwarwick@stwgtn.co.nz] 
Enviado el: Miércoles 04 de Septiembre, 2002 05:19 PM
Para: users@httpd.apache.org
Asunto: RE: [users@httpd] Simple URL redirection (mod_rewrite)


Try:

RewriteEngine on
RewriteBase /somedir/help
RewriteRule ^/somedir/help/(.*)$ /somedir/help/index.php?on=$1

I'm not sure if you would need the RewriteBase directive. The $ at the
end of the match string forces the rewrite module to include all
characters until the end and the ^ character means start the match at
the start (i.e. immediately after the domain name)

Another way to do this without using rewrites would be to use a help.php
script and the directives Options +multiviews AcceptPathInfo On then use
php to extract the rest of the path.

-----Original Message-----
From: Iván Vega Rivera [mailto:ivan@i-sol.biz]
Sent: Thursday, 5 September 2002 9:28 a.m.
To: users@httpd.apache.org
Subject: [users@httpd] Simple URL redirection (mod_rewrite)


Hi,

I'm trying to get Apache to rewrite URLs based on this simple need:

convert this: /somedir/help/chat
to this: /somedir/help/index.php?on=chat

I want to use an .htaccess file on /somedir/help, but I can't seem to
find the proper config for mod_rewrite... I've tried with this (remember
its under /somedir/help):

RewriteEngine on
RewriteBase /somedir/help
RewriteRule ^/(.*) index.iss?on=$1

But when I try to open /somedir/help/chat (which of course doesn't exist
physically), I get a 404.

I've already searched the web for examples on mod_rewrite, and I found
plenty, but I can't understand them! :( I also tried to read the
documentation of the module (no further comments...)

Can somebody please help me solve this apparently simple issue?

Thanks in advance.

Ivan V.





---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org








---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message