What is meant by "Discussions"?
url rewrite
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

QAIX > Apache HTTP Server > url rewrite 25 December 2006 17:32:56

  Recent blog posts: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:

url rewrite

Manohar N Ellanti 25 December 2006 17:32:56
 Can some one help clarify if this is feasible

subdomain-a.maindom­ain.com
subdomain-b.maindom­ain.com

Using url to file rewrite/mapping:

in /subdomain-a/.htacc­ess:

Rewriterule ^(.*)$ /www/shared/$1 [E=SUBDOMAIN:A]

in /subdomain-b/.htacc­ess
Rewriterule ^(.*)$ /www/shared/$1 [E=SUBDOMAIN:B]


Using url to url rewrite/mapping (supposed to be available in Apache
2.0)

in /subdomain-a/.htacc­ess:

Rewriterule ^(.*)$ http:/www.maindomai­n.com/shared/$1
[E=SUBDOMAIN:A]

in /subdomain-b/.htacc­ess
Rewriterule ^(.*)$ http:/www.maindomai­n.com/shared/$1
[E=SUBDOMAIN:B]

Though I tried both - I could not access the env variable from the PHP
scripts.

But, I think a more elegant solution may be setting the original uri
request information in a variable that is accessible to scripts like
PHP. For instance, SCRIPT_URL or SCRIPT_URI or a new variable something
like - URL_BEFORE_REWRITE.­ This would allow application script engines
(perl, php, jsp/servlets) to know the subdomain and accordingly alter
the content being served.

Another requirement if some one can show me how to do if possible
already-
After rewrite - the client browser should still show in the address bar
the original path - for instance //subdomain-a.maind­omain.com/xxxx
instead of //www.maindomain/sh­ared/xxxx -

-ellanti





-------------------­--------------------­--------------------­----------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.a­pache.org/userslist.­html> for more info.
To unsubscribe, e-mail: users-unsubscribe@h­ttpd.apache.org
" from the digest: users-digest-unsubs­cribe@httpd.apache.o­rg
For additional commands, e-mail: users-help@httpd.ap­ache.org


Add comment
Sebastian 28 March 2003 11:38:04 permanent link ]
 hello,
i am not sure where to post this question, since it's partly related to PHP,
so i'll ask here.

I'd like to rewrite a url
that looks like this: /news/articles/arti­cle.php?id=255

into /news/articles/255/­

any help is appreciated.

cheers,
- Sebastian
Add comment
Jason Wong 28 March 2003 11:52:46 permanent link ]
 On Friday 28 March 2003 16:38, Sebastian wrote:
i am not sure where to post this question, since it's partly related to> PHP, so i'll ask here.

Ask google or ask the archives.
I'd like to rewrite a url> that looks like this: /news/articles/arti­cle.php?id=255>
into /news/articles/255/­

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
-------------------­--------------------­---
Search the list archives before you post
http://marc.theaims­group.com/?l=php-gen­eral
-------------------­--------------------­---
/*
I know the answer! The answer lies within the heart of all mankind!
The answer is twelve? I think I'm in the wrong building.
-- Charles Schulz
*/


--
PHP General Mailing List (http://www.php.net­/)
To unsubscribe, visit: http://www.php.net/­unsub.php


Add comment
Sebastian 28 March 2003 12:16:33 permanent link ]
 
if that were the case I wouldn't have asked here.. perhaps i didn't find the
answer at "google or the archives."

----- Original Message -----
From: "Jason Wong" <php-general@gremli­ns.biz>

Ask google or ask the archives.


| On Friday 28 March 2003 16:38, Sebastian wrote:
|
| > i am not sure where to post this question, since it's partly related to
| > PHP, so i'll ask here.
|
| > I'd like to rewrite a url
| > that looks like this: /news/articles/arti­cle.php?id=255
| >
| > into /news/articles/255/­



--
PHP General Mailing List (http://www.php.net­/)
To unsubscribe, visit: http://www.php.net/­unsub.php


Add comment
Chris Hewitt 28 March 2003 14:23:22 permanent link ]
 Sebastian wrote:
if that were the case I wouldn't have asked here.. perhaps i didn't > find the> answer at "google or the archives.">
----- Original Message -----> From: "Jason Wong" <php-general@gremli­ns.biz> > <mailto:p­hp-general­@gremlins.biz>>
Ask google or ask the archives.>
| On Friday 28 March 2003 16:38, Sebastian wrote:> |> | > i am not sure where to post this question, since it's partly > related to> | > PHP, so i'll ask here.> |> | > I'd like to rewrite a url> | > that looks like this: /news/articles/arti­cle.php?id=255> | >> | > into /news/articles/255/­>

As a long time contributor to this list, Jason knows that this question
has been asked many times.

To help your research, I put "search engine friendly url" into the list
archive at http://marc.theaims­group.com at got quite a list back. One of
these gives a reference to

http://www.faqts.co­m/knowledge_base/vie­w.phtml/aid/124

which gives tutorials for doing it in PHP, mod_rewrite and/or mod_mime.

Hoping this helps.

Chris




--
PHP General Mailing List (http://www.php.net­/)
To unsubscribe, visit: http://www.php.net/­unsub.php


Add comment
Joshua Slive 19 August 2004 22:57:28 permanent link ]
 On Thu, 19 Aug 2004 09:01:19 -0700, Manohar N Ellanti
<none.el@comcast.ne­t> wrote:
But, I think a more elegant solution may be setting the original uri> request information in a variable that is accessible to scripts like> PHP. For instance, SCRIPT_URL or SCRIPT_URI or a new variable something> like - URL_BEFORE_REWRITE.­ This would allow application script engines> (perl, php, jsp/servlets) to know the subdomain and accordingly alter> the content being served.

Point your RewriteRules at a script that dumps the entire environment.
I think you'll find some useful stuff. (In particular, all the
REDIRECT_ variables.)

This only works, of course, if you do an internal redirect; that is,
don't put http:// on the front or use the R flag.
Another requirement if some one can show me how to do if possible> already-> After rewrite - the client browser should still show in the address bar> the original path - for instance //subdomain-a.maind­omain.com/xxxx> instead of //www.maindomain/sh­ared/xxxx -

This should work as long as you use an internal redirect (see above).

Joshua.

-------------------­--------------------­--------------------­----------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.a­pache.org/userslist.­html> for more info.
To unsubscribe, e-mail: users-unsubscribe@h­ttpd.apache.org
" from the digest: users-digest-unsubs­cribe@httpd.apache.o­rg
For additional commands, e-mail: users-help@httpd.ap­ache.org


Add comment
Manohar N Ellanti 19 August 2004 23:12:50 permanent link ]
 I think there was a discussion on the PHP boards - regarding
[E=xyz:value] not working in the sense the php script was not able to
pickup the xyz value - it was empty - if you can point me to some script
to dump all the Apache set environment variables I can give a try.

Regarding the second point - I am not sure why the restriction -
internal file based redirect or external url type redirect, the target
script will be called regardless. So if it is possible to carry
information regarding the original request it will help.

Actually using the http:// prefix is easier as sometime I may not know
the directory path where my target script, particularly in hosted
situations. I have see some use /usr/var, some use /www/www

So instead of trying to figure out the directory structure, I can very
safely use http// redirect - another option may be to use document_root
which might keep the type of redirect as internal.

Since I use http:// prefix in substitution pattern of Rewriterule, it
will be considered external redirect and hence the browser displays the
new URL and not the original one user entered.

-ellanti




-----Original Message-----
From: Joshua Slive [mailto:jslive@gmail.com]
Sent: Thursday, August 19, 2004 12:57 PM
To: users@httpd.apache.­org
Subject: Re: [users@httpd] url rewrite

On Thu, 19 Aug 2004 09:01:19 -0700, Manohar N Ellanti
<none.el@comcast.ne­t> wrote:
But, I think a more elegant solution may be setting the original uri> request information in a variable that is accessible to scripts like> PHP. For instance, SCRIPT_URL or SCRIPT_URI or a new variable
something> like - URL_BEFORE_REWRITE.­ This would allow application scripts
engines> (perl, php, jsp/servlets) to know the subdomain and accordingly
alter> the content being served.

Point your RewriteRules at a script that dumps the entire environment.
I think you'll find some useful stuff. (In particular, all the
REDIRECT_ variables.)

This only works, of course, if you do an internal redirect; that is,
don't put http:// on the front or use the R flag.
Another requirement if some one can show me how to do if possible> already-> After rewrite - the client browser should still show in the address
the original path - for instance //subdomain-a.maind­omain.com/xxxx> instead of //www.maindomain/sh­ared/xxxx -

This should work as long as you use an internal redirect (see above).

Joshua.

-------------------­--------------------­--------------------­----------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.a­pache.org/userslist.­html> for more info.
To unsubscribe, e-mail: users-unsubscribe@h­ttpd.apache.org
" from the digest: users-digest-unsubs­cribe@httpd.apache.o­rg
For additional commands, e-mail: users-help@httpd.ap­ache.org


-------------------­--------------------­--------------------­----------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.a­pache.org/userslist.­html> for more info.
To unsubscribe, e-mail: users-unsubscribe@h­ttpd.apache.org
" from the digest: users-digest-unsubs­cribe@httpd.apache.o­rg
For additional commands, e-mail: users-help@httpd.ap­ache.org


Add comment
Musosdev 19 December 2006 23:05:01 permanent link ]
 Hi guys,

I want to give out easier to remember URLs on my site, for Google and also
for users to give out to their friends and such.

Instead of
www.mysite.com/musi­c/viewartist?id=45
i'd like to be able to give out
www.mysite.com/band­name

and instead of
www.mysite.com/musi­c/viewdisc?id=101
id like to be able to give out
www.mysite.com/band­name/disc_name

2 questions..

1) I think I can do this from a custom 404? Could someone give me some idea
of how I might find and disect the directory given by the user, so that I can
query my database and redirect to the correct page.

2) how can I do the redirect without changing what the user sees in her
browser? I'd like it to always show www.mysite.com/band­name etc. Is this
possible?

Cheers



Dan
Add comment
Mike Brind 20 December 2006 00:07:29 permanent link ]
 
"musosdev" <musoswire@communit­y.nospam> wrote in message
news:7E3E0919-B0A1-­46E4-8AD9-BD5186627F­45@microsoft.com...
Hi guys,
I want to give out easier to remember URLs on my site, for Google and also
for users to give out to their friends and such.
Instead of
i'd like to be able to give out
and instead of
id like to be able to give out
2 questions..
1) I think I can do this from a custom 404? Could someone give me some
idea
of how I might find and disect the directory given by the user, so that I
can
query my database and redirect to the correct page.
2) how can I do the redirect without changing what the user sees in her
browser? I'd like it to always show www.mysite.com/band­name etc. Is this
possible?

This thread should provide your answers...
http://groups.googl­e.co.uk/group/micros­oft.public.inetserve­r.asp.general/browse­_frm/thread/c79c506e­f94c3e17/358dd1a9b3b­88cb3?lnk=gst&q=url+­rewrite&rnum=2&hl=en­#358dd1a9b3b88cb3

--
Mike Brind


Add comment
Steven Cheng 20 December 2006 06:32:30 permanent link ]
 Hi Dan,

for your scenario, what you what to do is commonly called "URL Rewriting",
which means use user/search engine friendly url to replace the underlying
dynamic url(with querystring parameters...). In classic ASP, you should
use some ISAPI filter to do this work. There are some existing 3rd party
IIS ISAPI filters for performing url rewriting:


#URL rewrite in IIS
http://meta.wikimed­ia.org/wiki/URL_rewr­ite_in_IIS

#ISAPI Rewrite - URL Rewriting for Windows Server IIS
http://www.seoconsu­ltants.com/windows/i­sapi/

#URL Rewrite Filter for IIS
http://www.iismods.­com/url-rewrite/inde­x.htm

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

Add comment
Steven Cheng 25 December 2006 15:29:27 permanent link ]
 Hi Dan,

Have you got any further ideas or progress on this issue? if you have any
new questions or anything else we can help, please feel free to post here.

Merry Christmas!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.



Add comment
Evertjan. 25 December 2006 17:32:56 permanent link ]
 Steven Cheng[MSFT] wrote on 25 dec 2006 in
microsoft.public.in­etserver.asp.general­:

Have you got any further ideas or progress on this issue? if you have
any new questions or anything else we can help, please feel free to
post here.

[please always quote on usenet, this is not email]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


QAIX > Apache HTTP Server > url rewrite 25 December 2006 17:32:56

see also:
grabbing data and auto email set users
issue with MySQL stored procedure and…
Nothing like it [STCK REPORT] divider…
пройди тесты:
see also:
China toner cartridge exporter…
HP laser toner cartridge exporter…
Clone2go Free Video Converter Released

  Copyright © 2001—2008 QAIX
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.qaix.com.
Сообщения об ошибках оставляем в сообществе bugs.qaix.com.
Предложения и комментарии пишем в сообществе suggest.qaix.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .