Read this ^


Nginx Settings:

Find a property Search Prop redirect

Add under charset utf8:

## AGENTSINSIGHT

# Find-a-property

location /find-a-property/ {

proxy_pass http://[client].search-prop.com/;

}

# Fonts

location /fonts {

proxy_pass http://cwr.search-prop.com/fonts/;

}

#redirect old property-search (needs work to include property title if possible)

rewrite ^/old-directory http://www.domain.com/find-a-property permanent;

Create a domain alias in Forge

Create actual domain first and upload git repo

Create a domain alias - don't add a new repo, leave it blank.

Edit the nginx file and look for (currently on line 8):

root /home/forge/your-domain-alias;

Update this to root to your real domain

root /home/forge/actual-domain;

Htaccess Settings:

<IfModule mod_rewrite.c>

RewriteEngine on

# Redirect old pages to new location (For SEO reasons)

RewriteCond %{QUERY_STRING} ([0-9]+)$

RewriteRule ^find-a-property/property.php$ find-a-property/properties/%1? [R=301,L]

# If you have site specific fonts in your template link them in here

RewriteRule ^fonts/(.*)$ http://YOUR_SUB_DOMAIN.search-prop.com/fonts/$1 [L,P]

# Put search-prop onto the url '/find-a-property'

RewriteBase "/find-a-property"

RewriteRule "^find-a-property(.*)$" http://YOUR_SUB_DOMAIN.search-prop.com/$1 [P,L]

</IfModule>

*note: DO NOT set the URL above as https, but DO set it as httpS in the admin area of search prop

If two search props use this htaccess and put in the root

<IfModule mod_rewrite.c>

RewriteEngine on

# If you have site specific fonts in your template link them in here

RewriteRule ^fonts/(.*)$ http://wp-c.search-prop-dev.com/fonts/$1 [L,P]

# Put search-prop onto the url '/find-a-property'

RewriteBase "/commercial/find-a-property"

RewriteRule "^commercial/find-a-property(.*)$" http://wp-c.search-prop.com/$1 [P,L]

# Put search-prop onto the url '/find-a-property'

RewriteBase "/residential/find-a-property"

RewriteRule "^residential/find-a-property(.*)$" http://wp-r.search-prop.com/$1 [P,L]

</IfModule>

.htacess file

RewriteEngine on

# Set site specific fonts to pull from search-prop

RewriteRule ^fonts/(.*)$ https://co.search-prop.com/fonts/$1 [L,P]

# Proxy search-prop onto the url 'https://www.your-site.com/find-a-property

RewriteBase "/find-a-property"

RewriteRule "^find-a-property(.*)$" https://co.search-prop.com/$1 [P,L]

CORS Issues

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin

Access-Control-Allow-Origin: https://co.search-prop.com


NOTES

  • For the redirect to work you cannot have a real folder in place that the re-write is trying to act on

    • "find-a-property folder was taking priority. Moving it out the way fixed the issue"

Microsoft Server (IIS) Settings:

Reverse Proxy with URL Rewrite v2 and Application Request Routing:


1: Enabling Reverse Proxy functionality
- https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing#configuring-rules-for-the-reverse-proxy

https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing#configuring-rules-for-the-reverse-proxy


2. Create the rewrite rule.
Below is an example rule set for loading a search-prop onto the url: http://example.com/property-search

<rewrite>

<rules>

<rule name="Reverse Proxy Search Prop" stopProcessing="true">

<match url="^property-search/(.*)" />

<action type="Rewrite" url="http://fc.search-prop.com/properties/{R:1}" />

</rule>

</rules>

</rewrite>

3. Check routing is working

Once 1 & 2 are complete, you should be able to go to: http://example.com/property-search and they will see the property search.

4. Important! Link rewrites

You'll notice that clicking links on http://example.com/property-search will take you to the http://example.search-prop.com website.

To overcome this issue please let your contact at agentsinsight know that you are ready to have the links set to the live domain. We will then toggle these so links keep the end-user on the http://example.com/property-search website.

Did this answer your question?