...

View Full Version : page redirect by htaccess



arctushar
08-03-2010, 01:43 AM
Hello
I m new in web site designing. I used various CMS. But I want to use my own coded php files. In CMS's I saw that it can redirect to specific file. For example

Someone write a blog about computer virus. And the alias of that blog is comvirus.html

requested url is http://mysite.com/comvirus.html it show the blog page.

In short how can I write htaccess file so that it can send requested url to a php file and the php file send the information which file have to show.

Hope you understand my problem and please solve this with details.

Valentin Jed
09-05-2010, 08:16 AM
Here is how I solved it.

.htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine on

RewriteRule ^article/([0-9]+)/(.*)+$ /index.php?module=article&id=$1
</IfModule>

http://domain.com/article/123/computer_virus

Now it will request the article with ID 123 from index.php that runs the article module. Now when you generate a link you just need to generate a slug from the title of the article.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum