?= ... stuck in extension

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

?= ... stuck in extension

Postby kshysieq » Thu Jul 30, 2009 8:49 am

I see that forum containes much sophisticated examples but I stuck in quite simpler one.

I need to change url on my site. I have:

http://site/index.php?tp=some_topic_without_extension

But I want to have:

http://site/some_topic_without_extension

I tried

RewriteEngine On
RewriteRule (.*) index.php?tp=$1 [QSA,L]

but it didin't work.

I've done some reserch and php log for $_GET shows - tp param receive somehow .html extension (some_topic_without_extension.html) :( (maybe .html file in the directory is the problem - but it should stay there)

Thanks for your help.
kshysieq
 
Posts: 1
Joined: Thu Jul 30, 2009 8:03 am
Location: Poland

Postby richardk » Thu Jul 30, 2009 3:47 pm

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

# Don't match existing files.
RewriteCond %{SCRIPT_FILENAME} !-f
# Don't match existing directories.
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^/]+)/?$ ./index.php?tp=$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 26 guests

cron