little help on mod_rewrie!
Moderator: General Moderators
little help on mod_rewrie!
Hi,
I think the mod_rewrite only works when we give the address in the address bar of static page manually.
what if i have http://www.abc.com website that has a link Contactus and takes me to the contactus.php and the address bar shows the address as http://www.abc.com/contactus.php,
but i want that the address bar showed the address as http://www.abc.com/contactus on this page with the help of mod_rewrite.
I am very thankful to you for this and have wasted 1 weak for this.
Thanks.
I think the mod_rewrite only works when we give the address in the address bar of static page manually.
what if i have http://www.abc.com website that has a link Contactus and takes me to the contactus.php and the address bar shows the address as http://www.abc.com/contactus.php,
but i want that the address bar showed the address as http://www.abc.com/contactus on this page with the help of mod_rewrite.
I am very thankful to you for this and have wasted 1 weak for this.
Thanks.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Code: Select all
RewriteBase /
RewriteEngine On
RewriteRule ^/contactus$ /contactus.phpCode: Select all
RewriteBase /
RewriteEngine On
RewriteRule ^([A-Za-z]+)$ index.php?page=$1feyd | Please use
index1.php
index1.php is main page,when the user clicks on the "click here", goes to the contact.php and the address bar shows the address as http://www.abc.com/contactus.php
but i want that the address bar showed the address as http://www.abc.com/contactus.
Now if u know, plz inform me.
Thanks.
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I think u could not get understand my point or u dont know the right code for this condition.
index1.phpCode: Select all
<?php
print "This is index1.php file....";
?>
<a href="contactus.php">Click here</a>Code: Select all
<?php
print "This is contact us file...";
?>but i want that the address bar showed the address as http://www.abc.com/contactus.
Now if u know, plz inform me.
Thanks.
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]The RewriteRule Jcart gave seems correct to me.
However you should change the url in the link as well:
index1.php
contactus.php
However you should change the url in the link as well:
index1.php
Code: Select all
<?php
print "This is index1.php file....";
?>
<a href="/contactus">Click here</a>Code: Select all
<?php
print "This is contact us file...";
?>- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
for all the non-aolspeakers heerajee wrote:feyd | Please useCode: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color] I think [color=red]you[/color] could not get understand my point or [color=red]you[/color] don[color=red]'[/color]t know the right code for this condition. index1.phpindex1.phpCode: Select all
<?php print "This is index1.php file...."; ?> <a href="contactus.php">Click here</a>index1.php is main page,when the user clicks on the "click here", goes to the contact.php and the address bar shows the address as http://www.abc.com/contactus.phpCode: Select all
<?php print "This is contact us file..."; ?>
but i want that the address bar showed the address as http://www.abc.com/contactus.
Now if u know, plz inform me.
Thanks.
feyd | Please useCode: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color][/quote]