|
 |
|
Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
|
|
08-21-2006, 03:59 AM
|
PM User |
#1
|
|
Senior Coder
Join Date: Aug 2005
Posts: 1,119
Thanks: 2
Thanked 1 Time in 1 Post
|
Another simple url rewrite
I want to turn articles/4.html into news.php?id=4
Any ideas?
|
|
|
|
08-22-2006, 07:11 AM
|
PM User |
#2
|
|
Senior Coder
Join Date: Aug 2005
Posts: 1,119
Thanks: 2
Thanked 1 Time in 1 Post
|
*bump*
|
|
|
08-24-2006, 02:05 AM
|
PM User |
#3
|
|
Senior Coder
Join Date: Aug 2005
Posts: 1,119
Thanks: 2
Thanked 1 Time in 1 Post
|
*bump*
|
|
|
08-30-2006, 01:41 AM
|
PM User |
#4
|
|
Senior Coder
Join Date: Aug 2005
Posts: 1,119
Thanks: 2
Thanked 1 Time in 1 Post
|
any ideas how to do this?
|
|
|
08-30-2006, 05:55 AM
|
PM User |
#5
|
|
Regular Coder
Join Date: Nov 2005
Location: LI
Posts: 356
Thanks: 21
Thanked 9 Times in 9 Posts
|
Code:
<?PHP
switch($id)
{
default:
echo "this is the default page";
case '4:
echo "put '4' content here";
break;
break;
}
?>
Last edited by Rappa; 08-30-2006 at 05:59 AM..
|
|
|
08-30-2006, 06:10 AM
|
PM User |
#6
|
|
Senior Coder
Join Date: Aug 2005
Posts: 1,119
Thanks: 2
Thanked 1 Time in 1 Post
|
What? That is NOT an htaccess rewrite. If you missed the first post, i will repeat it.
I want a user to be able to put articles/4.html in their browser and it to be parsed by the server as news.php?id=4
I don't need to know how to display different material according to the id #. Using htaccess rewrite methods only, how do I do this?
|
|
|
08-31-2006, 08:20 PM
|
PM User |
#7
|
|
Senior Coder
Join Date: Aug 2005
Posts: 1,119
Thanks: 2
Thanked 1 Time in 1 Post
|
does anyone know how to do this?
|
|
|
09-02-2006, 09:32 PM
|
PM User |
#8
|
|
Senior Coder
Join Date: Aug 2005
Posts: 1,119
Thanks: 2
Thanked 1 Time in 1 Post
|
*bump*
|
|
|
09-02-2006, 11:34 PM
|
PM User |
#9
|
|
Regular Coder
Join Date: Jul 2006
Location: birmingham, uk
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
|
you cant do that with .htacces try this though
PHP Code:
<?php
$action = $_GET['page'];
function yourfilename() {
include("yourfilename");
}
if ($page == "yourfilename") {
yourfilename();
}
?>
then you can make a link like index.php?page=yourfile
and it will display you file on the page
|
|
|
09-03-2006, 12:02 AM
|
PM User |
#10
|
|
Senior Coder
Join Date: Aug 2005
Posts: 1,119
Thanks: 2
Thanked 1 Time in 1 Post
|
So why wouldn't something like this work?
RewriteRule ^articles/(.*).html$ news.php?id=$1 [L]
That should work but there is a syntax error in there somewhere and I don't know what is wrong.
*edit*
Actually, this does work. View: http://image-space.net/articles/4.html and http://image-space.net/profile/news.php?id=4
Last edited by thesavior; 09-03-2006 at 12:05 AM..
|
|
|
09-03-2006, 12:29 PM
|
PM User |
#11
|
|
Regular Coder
Join Date: Jul 2006
Location: birmingham, uk
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
|
if you knew how to do it y post a thread onit?
|
|
|
09-03-2006, 02:40 PM
|
PM User |
#12
|
|
Senior Coder
Join Date: Sep 2005
Posts: 1,791
Thanks: 5
Thanked 36 Times in 35 Posts
|
Quote:
|
Originally Posted by googleit
you cant do that with .htacces try this though
|
yes, you can.
|
|
|
09-03-2006, 04:55 PM
|
PM User |
#13
|
|
Regular Coder
Join Date: Jul 2006
Location: birmingham, uk
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
|
k my bad
|
|
|
09-03-2006, 06:24 PM
|
PM User |
#14
|
|
Senior Coder
Join Date: Aug 2005
Posts: 1,119
Thanks: 2
Thanked 1 Time in 1 Post
|
i just came up with that. I didn't know it at the begining of this thread
|
|
|
09-03-2006, 10:57 PM
|
PM User |
#15
|
|
Senior Coder
Join Date: Sep 2005
Posts: 1,791
Thanks: 5
Thanked 36 Times in 35 Posts
|
the . probably needs to be escaped...
|
|
|
 |
|
Jump To Top of Thread
| Thread Tools |
|
|
| Rate This Thread |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +1. The time now is 04:11 PM.
|
Advertisement Log in to turn off these ads. |
|
|
|
|
|
|
|
|
|
|