landsman landsman - 2 months ago 18
Apache Configuration Question

htaccess mod_rewrite rule for one parameter

how can I write something like this:

RewriteCond %{QUERY_STRING} s=(\w+)
RewriteRule ^ wordpress/?s=%1 [L]


I need do rewrite rule from domain.com?s=something to domain.com/wordpress/?s=something.

Folder with wordpress is by symlink but It is not interesting.

Rule what I was send works but makes error 500 on other URLs like domain.com/something?company=1

Thanks

Btw: I must send this "body" twice for successful validation. Wtf @stackoverflow? And why are you cut greeting?

Answer

You just need this single rule:

RewriteEngine On

RewriteRule ^/?$ wordpress/ [L]

Original query string is automatically copied over.

Comments