D
D
digamer2020-05-25 12:29:10
PHP
digamer, 2020-05-25 12:29:10

Is it possible to write custom redirect rules for a subdomain?

There is a site with subdomains like cityname.domain.com

Previously, links to news/services, etc. were the same on all domains, unfortunately, some paths had to be changed and a redirect was required:
cityname.domain.com/news/category/1 -> cityname .domain.com/news/category-new/1

All I found on the Internet is just working with regular domains, or redirects from subdomains to domains.

I heard that you can do this through RewriteCond, but did not find even a close solution.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2020-05-25
@digamer

RewriteCond %{HTTP_HOST} ^cityname\.domain\.com$ [NC]
RewriteRule ^news/category/(\d+)$ /news/category-new/$1 [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question