473,396 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

URL rewriting

Can I have somekind of URL rewriting mechanism without touching the web
server's configuration (implemented in pure PHP) and win32 compatible? All
the info I have teaches about apache's mod_rewrite or other methods which
includes httpd.conf/htaccess editing. Assume I don't have any access to
both files.
Jul 17 '05 #1
4 1880
Ricky Romaya wrote:
Can I have somekind of URL rewriting mechanism without touching the web server's configuration (implemented in pure PHP) and win32 compatible? All the info I have teaches about apache's mod_rewrite or other methods which includes httpd.conf/htaccess editing. Assume I don't have any access to both files.


Explain what you want to achieve, like "from" and "to" URLs?

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jul 17 '05 #2
"R. Rajesh Jeba Anbiah" <ng**********@rediffmail.com> wrote in
news:11**********************@f14g2000cwb.googlegr oups.com:

Explain what you want to achieve, like "from" and "to" URLs?

Well, at least the same basic functionality of Apache's mod_rewrite. For
example, this URL:

http://www.foobar.com/en/my-index/

will be translated to

http://www.foobar.com/index.php?lang=en&page=my-index

before the webserver finally calls index.php with 'lang' and 'page'
arguments.
Jul 17 '05 #3
Ricky Romaya wrote:
"R. Rajesh Jeba Anbiah" <ng**********@rediffmail.com> wrote in
news:11**********************@f14g2000cwb.googlegr oups.com:

Explain what you want to achieve, like "from" and "to" URLs?
Well, at least the same basic functionality of Apache's mod_rewrite.

For example, this URL:

http://www.foobar.com/en/my-index/

will be translated to

http://www.foobar.com/index.php?lang=en&page=my-index

before the webserver finally calls index.php with 'lang' and 'page'
arguments.


I don't think, this case will be possible then. But, will be happy
if someone proves the other.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jul 17 '05 #4
NC
Ricky Romaya wrote:

Can I have somekind of URL rewriting mechanism without
touching the web server's configuration (implemented
in pure PHP) and win32 compatible?
Not really... URL rewriting is a pretty low-level HTTP
server functionality... This said, there may be ways
to make your URLs shorter and prettier...
For example, this URL:

http://www.foobar.com/en/my-index/

will be translated to

http://www.foobar.com/index.php?lang=en&page=my-index

before the webserver finally calls index.php with
'lang' and 'page' arguments.


Again, URL rewriting is out of question, so what I am about
to suggest is more like alternative ways of communicating
values without communicating names.

There is a hack (which I really don't recommend because I am
not sure this Apache behavior is intended)... Call your home
page like this:

http://www.foobar.com/index.php/en/my-index/

This should set your $_SERVER['PHP_SELF'] to "/en/my-index/",
which you can then parse like this:

$vars = explode('/', $_SERVER['PHP_SELF']);
$lang = $vars[1];
$page = $vars[2];

There is another hack, more standards-friendly:

http://www.foobar.com/?en/my-index/

This should set your $_SERVER['QUERY_STRING'] to "en/my-index/"
which you can parse like this:

$vars = explode('/', $_SERVER['QUERY_STRING']);
$lang = $vars[0];
$page = $vars[1];

Cheers,
NC

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jon Maz | last post by:
Hi All, I am experimenting with URL Rewriting using the techniques outlined by Scott Mitchell in his article "URL Rewriting in ASP.NET"...
3
by: Jamie Jackson | last post by:
I'm rewriting all links' onclick events, but I'm having a problem. The onclick event that I'm inserting works correctly in Opera, but not in FF or IE. I'm retroactively adding the statement...
2
by: Jon Maz | last post by:
Hi All, I've been looking into options for URL Rewriting in .net, and to be honest, I haven't seen anything that's easier than the old Classic Asp solution with an ISAPI filter redirecting to an...
3
by: Michael Appelmans | last post by:
I'm trying to use a rule based URL rewrite application which uses HttpApplication.RewritePath. I keep getting "rsource not found" error in application when running on shared web host although the...
2
by: R-D-C | last post by:
Can these two functions coexist? We have a web site where the querystrings are removed using URL Rewriting. Instead the page appears to be a html page with a long name (containing what would be...
0
by: Lee | last post by:
Hi all ;) Preamble -------- I'm using URL rewriting to enforce a frames policy (yeah, I know frames are 'bad' :) - i.e. if a request comes in for a page which should be nested within a...
3
by: Greg Collins [Microsoft MVP] | last post by:
I have done a bit of research of Url Rewriting, but as yet have been unsuccessful at getting it to work well, and there are issues around what file types are supported and how much code you want to...
9
by: Frankie | last post by:
I understand that with URL rewriting we can have a request come in for, say Page1.aspx, and rewrite it so that PageA.aspx gets served up to the user. My question (assuming the above is correct):...
2
by: Seth Williams | last post by:
The first scenario is that I want to create one website for a particular industry - let's say for Farm Machinery so I have a shared hosting site called myFarmMachinery.com But I want to sell...
1
Shinobi
by: Shinobi | last post by:
I am using ASP.net(c#) for my project. In my my project 2 pages are using URL rewriting method by referring this article URL Rewriting using Intelligencia UrlRewriter Example 1 - Blog Day...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.