Expand my Community achievements bar.

Dispatcher guru question -> "File does not exist: /mnt/var/www/html/institute/advocacy"

Avatar

Level 7

"File does not exist: /mnt/var/www/html/institute/advocacy"

 

hi folks,

 

I have a site "/content/institute". It used to be referenced as a branch from the url of the main site.   https://stage.mainsite-url.com/institute.

Now it is moved to https://stage.newsite-url.com

 

This is a typical page

/content/institute/en/advocacy.html

 

In my dispatcher, I have set up a virtual host to the site above,   "stage.newsite-url.com". 

I also have forward and reverse sling mappings in the publisher. I use URL shortening.

 

The new site works fine - except for redirects from the original urls, ie.  "stage.mainsite-url.com/institute/advocacy/"  gives a 404. The above dispatcher error message appears.  Somehow the url hasn't a "/content/" ???

 

I am assuming that all my problems are on the dispatcher and the publisher hasn't done anything.?

I have forward sling mappings but I assumed that they didn't do anything, and reverse ones too that do get used for my links.

jcr:primaryType="sling:Mapping"
sling:internalRedirect="[/content/institute/en/$1,/$1]"
sling:match="(.+)$/"/>

sling:internalRedirect="[/content/institute/en.html]"
sling:match="$"/>
sling:internalRedirect="[/content/institute/en/$1,/$1]"
sling:match="(.+)$"/>

 

I am completely mystified. Any debug hints would be useful. Can I put PRINT statement in the dispatcher host files ?

 

Any help appreciated.

 

thanks

Fiona

<IfModule mod_rewrite.c>
ReWriteEngine on
LogLevel info rewrite:info
##Global rewrite include
Include conf.d/rewrites/base_rewrite.rules

## This ruleset forces https in the end users browser
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{REQUEST_URI} !^/dispatcher/invalidate.cache
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]

RewriteRule ^/$ /content/institute/en/home.html [PT,L]
RewriteRule ^/institute/advocacy/$ https://stage.newsite-url.com/advocacy/? [R=301,NC,L]

RewriteMap lowercase int:tolower
RewriteCond $1 [A-Z]
RewriteCond %{REQUEST_URI} !^/conf
RewriteCond %{REQUEST_URI} !^/content
RewriteCond %{REQUEST_URI} !^/etc
RewriteRule ^/?(.*)$ https://%{SERVER_NAME}/${lowercase:$1} [R=301,L]

#START - URL shortening

RewriteCond %{REQUEST_URI} ^/home/
RewriteRule ^/home/ https://%{SERVER_NAME} [R=301,L]

# Handle request with no slash and no extension
RewriteCond %{REQUEST_URI} ^/.*
RewriteCond %{REQUEST_URI} !.*\..*$
RewriteCond %{REQUEST_URI} !.*/$
RewriteRule (.*)$ https://%{SERVER_NAME}$1/ [R=301,L,QSA]

# Handle requests to pages ending with .html
RewriteCond %{REQUEST_URI} ^/.*
RewriteCond %{REQUEST_URI} .*.html$
RewriteRule (.*).html$ https://%{SERVER_NAME}$1/ [R=301,L,QSA]

# Handle requests to pages ending with a trailing slash
RewriteCond %{REQUEST_URI} ^/.*
RewriteCond %{REQUEST_URI} .*/$
RewriteCond %{REQUEST_URI} !^/$
RewriteRule ^/(.*)/$ /content/institute/en/$1.html [PT,L,QSA]

#END - URL shortening


RewriteCond %{REQUEST_URI} !^/apps
RewriteCond %{REQUEST_URI} !^/bin
RewriteCond %{REQUEST_URI} !^/content
RewriteCond %{REQUEST_URI} !^/conf
RewriteCond %{REQUEST_URI} !^/crx
RewriteCond %{REQUEST_URI} !^/etc
RewriteCond %{REQUEST_URI} !^/home
RewriteCond %{REQUEST_URI} !^/libs
RewriteCond %{REQUEST_URI} !^/saml_login
RewriteCond %{REQUEST_URI} !^/tmp
RewriteCond %{REQUEST_URI} !^/var
RewriteCond %{REQUEST_URI} !^/grinmag
RewriteCond %{REQUEST_URI} !^/robots.txt

RewriteCond %{REQUEST_URI} !^/sitemap.xml
RewriteRule ^/(.*)$ /content/institute/en/$1 [PT,L]
RewriteCond %{REQUEST_URI} ^/aem/assetshome.html
RewriteRule ^/aem/assetshome.html.*$ %{HTTP:X-Forwarded-Proto}://%{HTTP_HOST}/assets.html/content/dam [R=302]

AllowEncodedSlashes On

</IfModule>

 

1 Reply

Avatar

Level 7

Actually, I think that moving all the redirects to the main site vhost file might be the way to go. I'll try that.