Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

321
Views
How do i make a htaccess variable optional?

How do i make that the third passed 'get' variable on first line is not mandatory? In other words, page only works if there are 3 'get' variables given, but in my case, i need the third one (e) to be optional. Any ideas?

RewriteRule ^ft/([0-9]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ forum.php?ft=$1&seo=$2&e=$3 [NC,QSA,L]
RewriteRule ^(fc|ft)/([0-9]+)/?$ forum.php?$1=$2 [NC,QSA,L]
RewriteRule ^forums/?$ forum.php [NC,L]
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

In that case to handle both 2 and 3 variables, try adding 1 more rules in your htaccess Rules file, have your htaccess rules file in following manner.

Please make sure to clear your browser cache before testing your URLs.

RewriteEngine ON
##Newly added rewrite Rule to handle 2 parameters in uri.
RewriteRule ^ft/([0-9]+)/([A-Za-z0-9-]+)/?$  forum.php?ft=$1&seo=$2 [NC,QSA,L]

##Rest of the rules go from here onwards....
RewriteRule ^ft/([0-9]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ forum.php?ft=$1&seo=$2&e=$3 [NC,QSA,L]
RewriteRule ^(fc|ft)/([0-9]+)/?$ forum.php?$1=$2 [NC,QSA,L]
RewriteRule ^forums/?$ forum.php [NC,L]
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!