How would I get the "data" from the following url:
example.com/data
into the index.php file which would be ran when you would go to just example.com
?
Thanks.
How would I get the "data" from the following url:
example.com/data
into the index.php file which would be ran when you would go to just example.com
?
Thanks.
I think this is technically stealing ... but knowledge is power.
echo file_get_contents("http://www.google.com");
The only problem is that images and junk wont show unless the source has been given a FQDN path. If you know that all the images are from one source though, then you can use a regular expression to tack the appropriate URL onto the source path of the images and forms. Then you basically have a replica of thier website, fully functional (atleast for that one page).
I think that by doing that, you are breaking copyright laws. That is, unless you are just trying to replicate all of your websites into one look easily.
I dont think thats what he wants.
somewhere in index.php put:
<?
include("example.com/data");
?>
BUT! example.com/data will just be calling an index page so just include that.
If this is not what you meant then im sorry.
Erm, sorry. Posted this very quickly and pretty late as well. Still pretty late but I've gotten some sleep so let me try to explain more in detail:
I currently have a script named article.php which is called like so:
www.mysite.com/article.php/id/41
To extract the "/id/41" section of the url above I would use the $_SERVER variable.
However, I would like to rename article.php to index.php so the new url would just be:
My first thoughts would be that it would still work.. that mysite.com would expand into mysite.com/index.php and the rest would be added on.
However, as it logically should, it parses "/id/41" as subdirs and its looking for those subdirs and is thus giving a 404 not found error.
Is there a way to accomplish the same behavior?
I remember reading once in an article on Zend about an apache setting which would achieve what I'm looking for. I believe it basically kept going down levels until it found a working script and then executed that along with the extra path info. IE: It checks mysite.com/id/41/ and it doesnt work so it checks mysite/id/ and since that doesnt work it then checks mysite.com/ which is a match, and then it also sends /id/41/ along to be avaliable in the $_SERVER variable.
Thanks for your help and sorry for the confusion.
What is the purpose behind why your doing it this way? www.mysite.com/article.php/id/41 does not really make sense. Are you thinking something along the lines of www.mysite.com/article.php?id=41??
If the reason your naming the file to index.php is so that you get this: www.mysite.com/id/41 then yes it will just be looking for a folder named 41.. Please explain better what id/41 exactly are. Also post the code of article.php =D
Well, actually. Would be too complex to explain what everything was so I simplified it down to give an example of what I was trying to.
I just dont understand this:
www.mysite.com/article.php/id/41
Can you post the coding of article.php??
You were correct about article.php. Its basically ?id=41
However, that really doesn't matter too much. I can already achive what I'm trying to do by going to mysite.com/index.php/id/41 but I would like it to work with just mysite.com/id/41
RewriteRule /id/(.*) article.php?id=$1
Look at this and see if this helps with what you want. http://phpbuilder.com/board/showthread.php?t=10233109
Kudose wrote:RewriteRule /id/(.*) article.php?id=$1
Will it still work if I remove the "id/" section from above?
I tried to get that working as it was and still no luck.
No.
RewriteRule ^ /([0-9]+) article.php?id=$1
Although I think you should pick one or the other. A regex that will allow for them both, if possible, would be really complex.
I see. Thank you.
Wow, I must look like a dick.
Will that work if I need to expand it to be more than 0-9 (assumming I changed the matching regex)?
I just noticed that these regexs wont work.
/([0-9]+)
will match 2index.php and return article.php?id=2
So I think you need ...
RewriteRule ^/([^\.]+$ article.php?id=$1
So it matches everything after the forward slash, but does not match if there is a period in the URL.
I haven't tested it though ...