: Friendly URLs with .htaccess I'm have the following .htaccess: RewriteEngine on RewriteCond %{request_filename} -f RewriteRule ^(.*) [L] RewriteRule ^(([^/]*)+)(/([^/]{0,32})(/.+)?)?$ index.php?a=&q=
I'm have the following .htaccess:
RewriteEngine on
RewriteCond %{request_filename} -f
RewriteRule ^(.*) [L]
RewriteRule ^(([^/]*)+)(/([^/]{0,32})(/.+)?)?$ index.php?a=&q= [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?
More posts by @Sent6035632
2 Comments
Sorted by latest first Latest Oldest Best
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
<script>
window.open('index.php?a=track&id=3','_self');
</script>
Hope this helps.
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.