Help with .htaccess - redirect only one kind of URLs

Hello,

this redirect redirects all subpages of a domain to another domain while not redirecting to index.php but to same page, only at another domain:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^cz\.hq-scenes\.com$ [NC]
RewriteRule ^(.*)$ http://cz.hq-scenes.com/$1 [R=301,L]

i want to achieve that only pages like /viewtopic.php…

will be redirected (… means any other characters)

Please how to redirect all viewtopic.php pages only? How to modiffy it?

slr,

Am I correct that you only want to redirect viewtopic.php with a query string or is viewtopic.php embedded as if it were a directory? That’s just basic regular expressions, of course.

Replace the dreaded :kaioken: EVERYTHING :kaioken: (or nothing) atom ( the “(.*)” ) with viewtopic\.php$. If the characters following the dot-php is a query string, it’ll be appended automatically otherwise, you’ll need to ensure Options +MultiViews is in your .htaccess and add the :kaioken: EVERYTHING :kaioken: atom before the $ (after the \.php). Of course, $1 will have to change to viewtopic.php (and $1 after that if not a query string), too.

You might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, tYou might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, too.

Regards,

DK