Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8014471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:56:44+00:00 2026-06-04T19:56:44+00:00

i want to write .htaccess whcih pass 5 letters to the page as variable

  • 0

i want to write .htaccess whcih pass 5 letters to the page as variable
those 5 letters are (small alphabets & numbers only)

For example if someone goto http://www.abc.com/etd01 i want to pass etd01 to http://www.abc.com/link.php?link=etd01

so i wrote

RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ LinkCode.php?LinkCode=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ LinkCode.php?LinkCode=$1

it is working but if some open http://www.abc.com/dswdrd then also it is passing the variable.
what i want is if length is 5 they pass otherwise do nothing

is it possible??

no i have change my .htaccess file to

RewriteEngine On
RewriteRule ^([a-z0-9]{5})/?$ LinkCode.php?LinkCode=$1

but now when i place

RewriteRule ^([a-z0-9]{5})/?$ LinkCode.php?LinkCode=$1

at the end of joomla .htaccess file it doesnt work

joomla .htaccess file is below

Options +FollowSymLinks

RewriteEngine On

RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

RewriteRule ^([a-z0-9]{5})/?$ LinkCode.php?LinkCode=$1

<Files ~ "\.vcf$">
ForceType text/x-vcard
</Files>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:56:46+00:00Added an answer on June 4, 2026 at 7:56 pm

    1) You have +, which means 1 or more. If you want 5 exactly, replace it by {5}.

    2) You said you want “(small alphabets & numbers only)”, but your template will ALSO match capital letters as well as minus - and underscore _. I have removed them from pattern to match your requirement.

    3) I’ve also joined 2 rules into 1 (will handle URL with and without trailing slash).

    RewriteEngine On
    RewriteRule ^([a-z0-9]{5})/?$ LinkCode.php?LinkCode=$1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create URL re-write rules for following URL in htaccess. http://example.com/vedios/category/fun/ ->
Currently I use seo like this. PHP: domain.com/index.php?page=account&do=forgotpassword .htaccess: domain.com/account/forgotpassword.html However, I want to
I am very new to .htaccess just want to write one rule which is
I want to write htaccess rewrite rule wherein if incoming url has .html or
I want to rewrite (not redirect) www.example.com to a foldername. I write: RewriteEngine On
I want to write a .htaccess from which the following action should be done.
Asking for your help: I want to write a htaccess rewrite rule that will
Guys, I want to write a .htaccess rewrite rule in zend framwork. MY URL
I've got a simple htaccess set up with which I only want to protect
Im new to this I want to write .htaccess file for my project.I wrote

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.