We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Htaccess RewriteRule? | Forum

Topic location: Forum home » Support » General Questions
Marcus
Marcus Dec 3 '18

Hi I am trying to rewrite URL but can make it happen:


site.com/1-2-id


to


site.com/1-2/id


RewriteRule ^1-2\-([^./]+)$ 1-2/$1 [L,QSA,NC]


What I am missing here.


Thanks

dave Leader
dave Dec 3 '18
Try this 


RewriteRule ^site\.com/1-2-id$ /site.com/1-2/id?&%{QUERY_STRING}


or this 


RedirectMatch 301 site.com/1-2-id(.*) site.com/1-2/id/$1


not tested



here is a tool to use   https://www.htaccessredirect.net/




The Forum post is edited by dave Dec 3 '18
Marcus
Marcus Dec 4 '18
Thanks Dave. I'm glad to learn that there is still someone out there willing to help. Case with all these rumors going on about that Oxwall is deal I was wondering weather to ask for support or not.
dave Leader
dave Dec 4 '18
your welcome, please share what works for you.  :)
Marcus
Marcus Dec 5 '18

I ended up using this like: RewriteRule ^site\.com/1-2-id$ /site.com/1-2/id?&%{QUERY_STRING}


But it's doesn't work on localhost for some reason:


http://localhost/oxwall/1-2-id


any ideas?

The Forum post is edited by Marcus Dec 5 '18
dave Leader
dave Dec 5 '18
ok try 


RewriteRule ^1-2-id$ /1-2/id?&%{QUERY_STRING}


i found this and played around a bit with the best answer


https://stackoverflow.com/questions/3501813/url-rewriting-on-localhost-apache-php


not tested 

Marcus
Marcus Dec 6 '18

Thanks buddy I can't make this work on localhost but it's cool case it works on live server what really matters.


Thanks for your time and support.