Is there a way i could get
http://somesite.com/viewer/someimage.jpg
to be recognised as
http://somesite.com/viewer/?id=someimage.jpg
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.
12 1764 Atli 5,058
Expert 4TB
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.
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:- - RewriteEngine on
-
-
RewriteRule ^viewer/([-_a-zA-Z0-9]+.jpg)$ /viewer/?id=$1 [L]
-
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:- - RewriteEngine on
-
-
RewriteRule ^viewer/([-_a-zA-Z0-9]+.jpg)$ /viewer/?id=$1 [L]
-
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
Atli 5,058
Expert 4TB
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: - myspace.com/username/Default.aspx
I tried that but it gave me an error. Not 404 tho.
Myspace is built using M$ technology, ASP.Net, so it would probably be more like: - 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)
:)
-
RewriteEngine on
-
RewriteRule ^viewer/([a-zA-Z0-1_-]+)\.([a-z]+)$ viewer/?ID=$1.$2 [L]
-
Is what i've came up with and t'is working! Thanks.
just 1 thing you have 0-1 in the regexp. You definitely only going to have 0 or 1 in the name?
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.
Atli 5,058
Expert 4TB
I'm not all that experienced with all this, but would it not be possible to replace "([a-zA-Z0-1_-]+)" with "(\w+)"?
I'm not all that experienced with all this, but would it not be possible to replace "([a-zA-Z0-1_-]+)" with "(\w+)"?
I was aware that there was some common expression that could take care of it, but i didn't know what it was.
Thanks Atli.
I'm not all that experienced with all this, but would it not be possible to replace "([a-zA-Z0-1_-]+)" with "(\w+)"?
Not quite \w is for the following range:-
a-zA-Z0-9_
so misses out the - but of course you could add that in. I personally however prefer whenever possible to use ranges so that it is easier to see what a regular expression does. Unless you specifically know what \w does you will have problems decoding the regexp whereas you have a better chance with actually using the ranges.
Not quite \w is for the following range:-
a-zA-Z0-9_
so misses out the - but of course you could add that in. I personally however prefer whenever possible to use ranges so that it is easier to see what a regular expression does. Unless you specifically know what \w does you will have problems decoding the regexp whereas you have a better chance with actually using the ranges.
Yeh, i was going to stick with
a-zA-Z0-9_-
For that very reason. Although knowing about \w is helpful for future reference :)
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - How do I change the text in the url/location bar?...
|
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...
|
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"
|
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...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
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...
|
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...
| |