apache - mod_rewrite that operates on relative paths in .htaccess -


i want apache convert or redirect

example.com/somecontroller/someaction/5 

to

example.com/?c=somecontroller&a=someaction&id=123 

i put mod_rewrite rules in .htaccess file can put in same directory index.php. in example above .htaccess , index.php in example.com-folder.

i rules operate on relative paths work if site on domain , in subdirectory. example:

otherdomain.com/subdirectory/somecontroller/someaction/5 

to

otherdomain.com/subdirectory/?c=somecontroller&a=someaction&id=123 

in example, index.php , .htaccess inside "subdirectory" folder.

this rule should it:

rewriterule ^(.*/)?([^/]+)/([^/]+)/([^/]+)$ $1?c=$2&a=$3&id=$4 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -