Im developing a website which supports SEF urls. I use PHP as serverside language. I know htaccess basic codes how works with it. But the problem is if I want to rewrite a php get link I have to put each both links on htaccess like this.
RewriteRule ^sign-in$ index.php?view=signin
RewriteRule ^register$ index.php?view=register
RewriteRule ^jobs$ index.php?id=2
Is there any possible way to automate urls with htaccess and url particular alias instead of adding Rewrite rules manually? something like joomla? I was trying to understand how joomla htaccess connects with particual alias. But I still couldn’t understand how it works. I cant uderstand how joomla htaccess makes relationship with article aliases. Please help. Thanks in advance.
If there isn’t any difference for how an
idlooks like compared to how aviewlooks like (in your example,registeris aviewandjobsis anid=2), then you have to do one or the other individually:To “automate” the views you could try just doing this:
EDIT: If you need to do these mappings via an external set of aliases, you need to take a look at the
RewriteMapdirective. You will need to have access to the server or vhost configs in order to setup the map, but your rules can stay in an htaccess file.Say you have a text file called “joomla_maps.txt” that looks like:
etc…
You can use that mapping by setting it up in a
RewriteMap(in vhost/server config)And later in your htaccess:
Take a look through the
RewriteMapdocs to get some examples of other kinds of maps, including executing a script or using a dbm hash map.