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
    Dec 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy .htaccess file prob

    jayson.barino@yahoo.com

    Hello!!!

    I have a problem with SEF url in PHP
    I want url like
    www.domain.com/index/user/username

    actual url
    www.domain.com/index.php?user=xyz

    and my .htaccess file is

    <files ~ "^\.ht">
    Order allow,deny
    Deny from all
    </files>
    <IfModule mod_rewrite.c>
    RewriteBase /
    <Files site>
    ForceType application/x-httpd-php
    </Files>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^localhost
    RewriteCond $1 !^GUI/
    RewriteRule ^(.*)$ /office/GUI/$1 [L]
    RewriteRule index/(.*)/(.*)/$ /index.php?$1=$2 [P]
    </IfModule>

    but i am getting redirected by typing this url in

    www.domain.com/index/user/username

    Can you please let me know where i have done mistake.

    Thanks in advance
    Sang

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    First, this isn't PHP code at all. Second, its definitely not a snippet. Moving from PHP Snippets to Apache configuration.
    What you have and describe is correct (though you don't appear to need the files directive to control the htaccess file. That doesn't really make sense). You type in yoursite.com/index/user/Username, and you are redirected to index.php?user=Username correct? This is the normal behaviour of mod_rewrite. Sounds to me like you are also expecting it the other way around, but your links themselves will not rewrite in this way.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

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