Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

Mod Rewrite

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Next:  Basic pointer question  
Author Message
soho

External


Since: May 04, 2004
Posts: 1



(Msg. 1) Posted: Wed May 05, 2004 12:48 am
Post subject: Mod Rewrite
Archived from groups: alt>apache>configuration (more info?)

Hello,

I have writen this script in .htaccess:

RewriteEngine on
RewriteBase /
RewriteRule pers/(.*) http://www.mysite.net/personals/skpers.php?u=$1 [L,R]

It is ok, infact if i write:

www.mysite.net/pers/example

it redirecto to: www.mysite.net/personals/skpers.php?u=example

But i must do this way:

if write:

www.mysite.net/?example

it redirect to: www.mysite.net/personals/skpers.php?u=example

I have tried with this script:

RewriteEngine on
RewriteBase /
RewriteRule pers/^/?(.*) http://www.mysite.net/personals/skpers.php?u=$1
[L,R]

But don't work, why?

Thanks

 >> Stay informed about: Mod Rewrite 
Back to top
Login to vote
spam3

External


Since: Jul 01, 2003
Posts: 411



(Msg. 2) Posted: Wed May 05, 2004 1:13 am
Post subject: Re: Mod Rewrite [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Soho wrote:
 > Hello,
 >
 > I have writen this script in .htaccess:
 >
 > RewriteEngine on
 > RewriteBase /
 > RewriteRule pers/(.*) <a style='text-decoration: underline;' href="http://www.mysite.net/personals/skpers.php?u=$1" target="_blank">http://www.mysite.net/personals/skpers.php?u=$1</a> [L,R]
 >
 > It is ok, infact if i write:
 >
<font color=purple> > <a style='text-decoration: underline;' href="http://www.mysite.net/pers/example</font" target="_blank">www.mysite.net/pers/example</font</a>>
 >
<font color=purple> > it redirecto to: <a style='text-decoration: underline;' href="http://www.mysite.net/personals/skpers.php?u=example</font" target="_blank">www.mysite.net/personals/skpers.php?u=example</font</a>>
 >
 > But i must do this way:
 >
 > if write:
 >
<font color=purple> > <a style='text-decoration: underline;' href="http://www.mysite.net/?example</font" target="_blank">www.mysite.net/?example</font</a>>
 >
<font color=purple> > it redirect to: <a style='text-decoration: underline;' href="http://www.mysite.net/personals/skpers.php?u=example</font" target="_blank">www.mysite.net/personals/skpers.php?u=example</font</a>>
 >
 > I have tried with this script:
 >
 > RewriteEngine on
 > RewriteBase /
<font color=purple> > RewriteRule pers/^/?(.*) <a style='text-decoration: underline;' href="http://www.mysite.net/personals/skpers.php?u=$1</font" target="_blank">http://www.mysite.net/personals/skpers.php?u=$1</font</a>>
 > [L,R]
 >
 > But don't work, why?

<a style='text-decoration: underline;' href="http://www.mysite.net/?example" target="_blank">http://www.mysite.net/?example</a>
The ?example part is not part of the URI, but it is in the query string.
If you want to create rules based on the query string, I believe that
you have to do use RewriteCond with %{QUERY_STRING} followed by the
rule. I haven't tried anything like this myself.

One option that you also have is to make your php file redirect the
request with the header function. For instnace, you may do something
like this at the very beginning of the script:

<?php
if(count($_GET)===1){
// if there is only one _GET variable
foreach($_GET as $key=>$val)
header('Location: <a style='text-decoration: underline;' href="http://www.mysite.net/pers/" target="_blank">http://www.mysite.net/pers/</a>'.$key);
exit;
}
?>

--
Justin Koivisto - spam RemoveThis @koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Mod Rewrite 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Mod rewrite and OSX - Hi, Mod_rewrite is loaded in httpd.conf, but it does not work, is that something I missed ? Coluche

rewrite url - Hi, I have two domain names on the same IP-address (IP-host based). How can I redirect one of the domains to another documentroot ? Regards and the best wishes for 2004. Michael

Mod rewrite - Hallo, I have write in a .htaccess File something like this: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]*)?/?([^/]*)?/?([^/]*)?/?([^/]*)?/?.*? index.php?show=$1&s2=$2&s3=$3&s4=...

mod-rewrite - I am attempting to use mod-rewrite to chnage my dynamically created pages into static urlls for search engine submission. I am unable to get the rewrite to work, it doesn't seem to do anything. Here is the code RewriteEngine on RewriteBase..

Mod Rewrite help - I've got 10,000+ files in a folder http://www.myseite.com/acrhives/ i.e. .../archives/2000/12/, .../archives/2000/11/, .../archives/2000/10/ ... Several years, many months of html mhonarc-archived docs. We have so many files in this one folder, I've..
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
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



[ Contact us | Terms of Service/Privacy Policy ]