Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    page redirect by htaccess

    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.

  • #2
    New to the CF scene
    Join Date
    Sep 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •