Hi,
Now I’m developing web template system so I want to develop at one folder to ease for maintaining.
I want user visit http://128.199.192.85/~a123 is http://128.199.192.85/template/?param=a123
if user go deeper like http://128.199.192.85/~a123/office is http://128.199.192.85/template/office/?param=a123
and deeper http://128.199.192.85/~a123/office/login.php is http://128.199.192.85/template/office/login.php?param=a123
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
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.