As per the example in Mad Mod Rewriters tutorial....

New to mod_rewrite? This is a good place to start.

As per the example in Mad Mod Rewriters tutorial....

Postby Brook » Tue Mar 07, 2006 8:15 pm

I am simply trying to rewrite/replace a word in a url with a different word, a bit like in Mad Mod Rewriters example below.

I am using a forum and want to change the thread urls to something else eg:

original urls: mysite.com/forums/viewtopic.php?p=47654

What i want: mysite.com/forums/my-own-word.php?p=47654

Is this possible?

Hope someone can help!! :)

Other times, like when you use php or other dynamic generation, and have 'stuff' after the question mark of a URL that is hard for a search engine to read, (if they can read it at all):
http://yoursite.com/index.php?stuff=show-this
You will want to keep quiet about where the information is coming from.

To do this you create a link that goes to a page that does not exist (fake):
http://yoursite.com/stuff/show/this.html (fake)

Then you tell your server, through a htaccess file, when somebody clicks on the fake link to
http://yoursite.com/stuff/show/this.html
the information they want is at:
http://yoursite.com/index.php?stuff=show-this (real)

Your server then gives the information from
http://yoursite.com/index.php?stuff=show-this (real)
While the browser shows the location as
http://yoursite.com/stuff/show/this.html

Since you don't want to tell everyone where the 'real' information is, you tell the server to just give it to them, and not to send a code that says anything different. (It is Important to notice the words the php file (real) needs are in the fake address, URL.)

This type of redirect is known as internal or silent. Meaning only you, and your server internals know that you switched the files. (This type of redirect when used properly, returns a 200-code, which says 'found'.)
Brook
 
Posts: 1
Joined: Tue Mar 07, 2006 8:09 pm

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 31 guests

cron