Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-17-2010, 12:05 PM   PM User | #1
sangeetakk
New to the CF scene

 
Join Date: Dec 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
sangeetakk is an unknown quantity at this point
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
sangeetakk is offline   Reply With Quote
Old 05-17-2010, 04:12 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,662
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:01 AM.


Advertisement
Log in to turn off these ads.