Reputation: 19252
I have a single page index.php. I would like to accept parameters in the form /value
. Right now, if I add anything after a /
, it assumes I'm trying to access a separate file and errors out. Is there a way I could accept params by adding /value
Upvotes: 1
Views: 1124
Reputation: 5658
You have to use apache's rewrite module. Check that rewrite_module
is active.
Then you could place a simple .htaccess
file in you directory with the following rules to do the job:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !-d
RewriteRule (.*) index.php?value=$1 [L,NS]
This rules with activate rewrite engine and place everythin after /
into value
variable.
Have a look to the rewrite documentation and then adjust the rules to your own.
Upvotes: 1