Rewrite rule for webtemplate system

  • Posted October 3, 2014


Now I’m developing web template system so I want to develop at one folder to ease for maintaining.

I want user visit is

if user go deeper like is

and deeper is

I try many rewrite rules but does work, this one should work but failed again

RewriteEngine On RewriteRule ^/~([^/]+)(.*) /template$2?param=$1 [PT,QSA]

please advice


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This rewrite rule should do what you are looking for:

RewriteEngine On
RewriteBase  /template
RewriteRule ^\~(.*?)\/(.*) /$2?param=$1 [PT,QSA]

There is an online htaccess tester tool that is extremely useful for debugging and testing rewrite rules. It’s a great resource for working on something like this.