I'm have the following .htaccess:

RewriteEngine on 
RewriteCond %{request_filename} -f
RewriteRule ^(.*) $1 [L]
RewriteRule ^(([^/]*)+)(/([^/]{0,32})(/.+)?)?$  index.php?a=$1&q=$3    [L]

My links look like this: /index.php?a=track&id=3. And even if I can't modify the .htaccess file, I would like URLs like this: example.com/example.html.

How can I achieve this?

  • 2
    If you don't have access to .htaccess file, why are you even asking this question?
    – Aakash
    Commented Jul 17, 2015 at 12:17
  • 2
    "My links look like this: /index.php?a=track&id=3" - The current directive in your .htaccess file already suggests otherwise?! .htaccess is only half the story when creating friendly URLs, you need to make sure the URLs are already friendly in your application.
    – MrWhite
    Commented Jul 24, 2015 at 21:19

2 Answers 2


What both @Aakash and @w3dk state in their comments is important. When using .htaccess to enable friendly URL's you have to first make sure that you actually have access to the .htaccess file on the server, then you need to make sure your server is configured to support .htaccess for URL rewrites (most cPanel and Plesk servers are).

After the .htaccess file has been configured correctly though you need to change your website code to render links as SEO friendly links in line with your .htaccess file instead of with the URL parameters.


If you cannot access the .htaccess file and if the number of these links that you want are small, it would be possible for you to create the friendly files like example.html etc. and load the index.php with the corresponding parameters using an iframe.

Just style the iframe to make it look invisible.

<iframe style="border:0;height:100%;width:100%;position:fixed;top:0;left:0;overflow:auto;" src="index.php?a=track&id=3"></iframe>

If you want the url to look clean, this is probably the only way to do without having access to the .htaccess file.

If you want the url to be clean in order to share it with people, you can use


Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.