Solved

rewriterule: Why test/home becomes test?/home

Posted on 2004-04-01
4
201 Views
Last Modified: 2010-03-04
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
Comment
Question by:dhosting
  • 2
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
BigRat earned 250 total points
ID: 10739522
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
 

Author Comment

by:dhosting
ID: 10886315
Hi,

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

thnx

0
 

Author Comment

by:dhosting
ID: 10886375
I played with it somemore and now it works great!

thnx a lot
0
 
LVL 27

Expert Comment

by:BigRat
ID: 10887912
OK. I suspect that you did not do a Copy&Paste with the rule and lost something!
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question