rewrite url parameters with htaccess?

potatis

New Member
Joined
Sep 4, 2019
Messages
11
Reaction score
0
Credits
0
Hello,

been trying to find a htaccess forum on the internet but havent found any so i hope that maybe you guys could help me.

at the moment my url look like this:
example.com?para1=15&para2=today

sometimes only one of the parameters are set ie:
example.com?para2=today

I want to rewrite the url to look like
example.com/15/today
example.com/today

the file is not always the same file so i guess {SCRIPT_FILENAME} or something has to be used.

I do at the moment hide .php extension. I dont know if you need to have that information or not:


RewriteEngine on
RewriteBase /

# Remove php extension
rewritecond %{SCRIPT_FILENAME}.php -f
rewriterule [^/]$ %{REQUEST_URI}.php [QSA,L]
rewriterule ^(.*)/$ $1 [R=301,L]


i tried doing this but it didnt make it work
RewriteRule ^([^/]+)/([^/]+)$ test.php?t=$a
 
Last edited:

Members online


Latest posts

Top