473,789 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change url without actually changing it.

Markus
6,050 Recognized Expert Expert
Is there a way i could get

http://somesite.com/viewer/someimage.jpg

to be recognised as

http://somesite.com/viewer/?id=someimage.j pg

I know i could rewrite the url with .htaccess but i don't want to change the lettering in the url.

The thing im trying to get at is;
how myspace do: myspace.com/username
but the 'username' isn't an actual directory.
I'm guesing it is read as myspace.com/?user=username

Hmm, anyone?

Thanks.
Nov 22 '07 #1
12 1788
Atli
5,058 Recognized Expert Expert
Hi Markus.

Based on my brief experience with MySpace, I could very well believe that they actually create a directory for each user with a dynamically created index file.

Other than the UrlRewrite thing, I'm not sure how you could do what you are asking.

I'm very interested in seeing if anybody has a solution to this.
Nov 23 '07 #2
coffear
20 New Member
A normal mod rewrite rule is what you are looking for. As long as you do not specify the R flag in the rule the user will be unaware of anything happening.

For example something like this will work:-

Expand|Select|Wrap|Line Numbers
  1. RewriteEngine on
  2.  
  3. RewriteRule ^viewer/([-_a-zA-Z0-9]+.jpg)$ /viewer/?id=$1 [L]
  4.  
Nov 23 '07 #3
Markus
6,050 Recognized Expert Expert
A normal mod rewrite rule is what you are looking for. As long as you do not specify the R flag in the rule the user will be unaware of anything happening.

For example something like this will work:-

Expand|Select|Wrap|Line Numbers
  1. RewriteEngine on
  2.  
  3. RewriteRule ^viewer/([-_a-zA-Z0-9]+.jpg)$ /viewer/?id=$1 [L]
  4.  
Thanks man! I had that exact(near enough) same rewrite just i had the [L] bit different!

Thanks again.

And @ atli:

if you go to myspace.com/username/index.php there isn't such a thing. I was told once it's done by virtual hosting? Not sure what that is, but y'know!

Thanks.x
Nov 23 '07 #4
Atli
5,058 Recognized Expert Expert
And @ atli:

if you go to myspace.com/username/index.php there isn't such a thing. I was told once it's done by virtual hosting? Not sure what that is, but y'know!

Thanks.x
Myspace is built using M$ technology, ASP.Net, so it would probably be more like:
Expand|Select|Wrap|Line Numbers
  1. myspace.com/username/Default.aspx
I tried that but it gave me an error. Not 404 tho.
Nov 24 '07 #5
Markus
6,050 Recognized Expert Expert
Myspace is built using M$ technology, ASP.Net, so it would probably be more like:
Expand|Select|Wrap|Line Numbers
  1. myspace.com/username/Default.aspx
I tried that but it gave me an error. Not 404 tho.
Truth be told, i don't care for MySpace - i was just intriguied by this, and now i may be able to build a networking site. (Not for general public use, just for a project)

:)
Nov 24 '07 #6
Markus
6,050 Recognized Expert Expert
Expand|Select|Wrap|Line Numbers
  1. RewriteEngine on 
  2. RewriteRule ^viewer/([a-zA-Z0-1_-]+)\.([a-z]+)$ viewer/?ID=$1.$2 [L] 
  3.  
Is what i've came up with and t'is working! Thanks.
Nov 24 '07 #7
coffear
20 New Member
just 1 thing you have 0-1 in the regexp. You definitely only going to have 0 or 1 in the name?
Nov 24 '07 #8
Markus
6,050 Recognized Expert Expert
just 1 thing you have 0-1 in the regexp. You definitely only going to have 0 or 1 in the name?

Oh! Thanks, i didn't see that - damn typos.
Nov 24 '07 #9
Atli
5,058 Recognized Expert Expert
I'm not all that experienced with all this, but would it not be possible to replace "([a-zA-Z0-1_-]+)" with "(\w+)"?
Nov 25 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
17311
by: Csaba2000 | last post by:
I have set onmousedown to change the cursor, but this setting is ignored (IE 5.5; NN 6.1 on Win 2K Pro) until the mouse is either moved or the mouse button is released. On Opera 7.01, the setting seems to be ignored completely, even when I try with window.setTimeout. So my two questions are: (1) Most important: Is there anything I can do so that I don't have to wait for the next mouse event before the cursor gets repainted. (2) Why...
4
2635
by: Richard Cornford | last post by:
For the last couple of months I have been trying to get the next round of updates to the FAQ underway and been being thwarted by a heavy workload (the project I am working on has to be finished an QA tested for a new year release. I don't think that going to prove practical, but there is no harm in trying :) and some serious family commitments. But it has to be done soon so this is stage one. Mike Winter provided an extensive list of...
5
7123
by: Hank | last post by:
My Access 2000 code has been running for several years in our main plant. Now we need to install it, as a stand-along application, at remote sites, some of which are out of state. My problem is the printer destination for special reports such as stickers and mailing labels. The Mailing Label report is, of course, designed here for a specific printer (Mailing Label). At another site, the name could be completely different. Other than...
7
1345
by: Peter Oliphant | last post by:
I use to make the statement that you could always replace any 'private' or 'public' access with 'public' and the code would still compile. This is no longer the case. It turns out that in /clr it is not allowed (as far as I can tell) to reduce the access of a virtual method defined in a base class. Thus, if one declares a virtual method in a base class as 'protected' and then proceeded to create derived classes with the virtual method...
6
3120
by: Michelle Stone | last post by:
Hi I am doing a bilingual .NET application for English/Arabic. On a web form, I have some edit boxes for data entry in Arabic and some for entry in English. Right now the user has to change his keyboard language by pressing ALT+SHIFT (or by changing the language manually elsewhere) each time he wants to shift from one language to another.
4
3671
by: K.N.Ranjit | last post by:
Hi to all friends out there, I'm facing this problem for atleast 2 days but still have'nt yet solved my problem.I send the mail few days back (ie) in VB.net how to shift my form coordinates (ie) by default (0,0) is in the top-left corner of the form but right now I need it in the bottom left corner of my form (ie) my (0,0) coordinates.I dont know coding.I tried changing the form property location but this location property is to place...
5
443
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I change the text in the url/location bar? ----------------------------------------------------------------------- This text can only be altered by changing the URL of the page. The normal solution is to use frames, though this can introduce problems of its own. ===
45
18905
by: Zytan | last post by:
This returns the following error: "Cannot modify the return value of 'System.Collections.Generic.List<MyStruct>.this' because it is not a variable" and I have no idea why! Do lists return copies of their elements? Why can't I change the element itself? class Program { private struct MyStruct
11
7461
by: Simon | last post by:
Dear reader, The syntax for the VBA code to change the RowSource of a Master Report is: Me.RowSource = "TableOrQueryName"
2
9455
by: Tamer | last post by:
Hi! Is there a way to change the protocoll type through Javascript without reloading (or making a request from the webserver) via Javascript? for example: http://mydomain.com -https://mydomain.com and backwards (if possible).
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9499
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10374
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10177
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10124
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7519
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5540
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.