Mobile app version of vmapp.org
Login or Join
Sent6035632

: 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=

@Sent6035632

Posted in: #Htaccess #Url #UserFriendly

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?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Sent6035632

2 Comments

Sorted by latest first Latest Oldest Best

 

@Si4351233

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.

10% popularity Vote Up Vote Down


 

@Si4351233

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme