• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 207
  • Last Modified:

rewriterule: Why test/home becomes test?/home

Hi,

I the code below to make test.php?content=home look like test/home, but when I enter test/home the URL in my addressbar show test?/home. I hate that ? so I am looking for a solution to drop that ?. Also I am wondering if there is an easier way. Because now I have to declare each file with the files statement. I am working on a .htaccess bases, because I don't have access to the .conf file for this.

The code I am using:
<Files test>
ForceType application/x-httpd-php
</Files>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^test/([/A-Za-z0-9_]*)$  test?/$1 [R]
</IfModule>

thnx
0
dhosting
Asked:
dhosting
  • 2
  • 2
1 Solution
 
BigRatCommented:
RewriteRule ^test/([/A-Za-z0-9_]*)$  test.php?content=$1 [L]

Use L for Last and not R for Redirect. The R sends a redirect BACK to the browser. There is no reason why the browser should see the rewrite.

You can then drop the Files/mime association.

HTH
0
 
dhostingAuthor Commented:
Hi,

Whenever I am going to a URL, let's say test/something, $content is defined as test and not something.

thnx

0
 
dhostingAuthor Commented:
I played with it somemore and now it works great!

thnx a lot
0
 
BigRatCommented:
OK. I suspect that you did not do a Copy&Paste with the rule and lost something!
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now