URL rewriting with /!#/ symbol in web.config - asp.net

I want to redirect my old url https://mysite1.com/#!/page1
to new url https://mysite2.com/page1,
other answers did not help, tried.
<rule name="Red1" stopProcessing="true">
<match url="^([0-9]+)/page1" />
<action type="Redirect" url="https://mysite2.com" />
</rule>

Assuming you meant #! per your example URL, not !# as in your title, add this JS to all your pages' <head>s:
(function(l,p){l.pathname==='/'&&(p=l.hash.match(/^#!(\/.*)/))&&l.replace(l.protocol+'//'+l.host+p[1])})(location);
This basically just removes the first /#!. You may have to alter it if your URLs contain a query part before the fragment.

Related

Fishpig 3 column layout not working in page/post

Followed these instruction to display a 3 column layout for page/post:
fishpig layout XML.
Used the local.xml of the theme in app/design/frontend/my_theme/default/layout/local.xml
but view is still default 2 column layout.
I have looked into this and tested a few things on your site (you provided access details via email) and found that the code at this link does in fact work. The extension uses the layout handle 'wordpress_{{post_type}}_view' for each different post type. Therefore, for posts, you can change the root template with the following XML:
<wordpress_post_view>
<reference name="root">
<action method="setTemplate"><template>page/3columns.phtml</template></action>
</reference>
</wordpress_post_view>
I have tested this on your site, added it to your theme's local.xml file and refreshed the layout cache. This has correctly changed the root template of your blog posts to the 3 column layout.
For pages, I used the following XML code:
<wordpress_page_view>
<reference name="root">
<action method="setTemplate"><template>page/3columns.phtml</template></action>
</reference>
</wordpress_page_view>
Again, I added this to your local.xml file, refreshed the cache and then your Pages had a 3 column page layout.

How to exclude images from Plone navigation tree by default

I notice that if I make a page and add and upload an image to include in it, by default it is included in the site navigation. How can I stop this from happening automatically?
Option 1
There is a Plone setting which tells which types are included in the navigation. Go to ZMI > portal_propeties > navtree_properties > metaTypesNotToList and add Image there.
Option 2
For each image, toggle checkbox "Exclude in navigation" on Image's Settings tab.
if you need to do so on a container basis, you could use the content rule included in sc.contentrules.metadata.
just add it to your buidout and configure it manually to set the ExcludeFromNav field to True.
an alternate way to do so is to include a contentrules.xml in your project profile with something like this:
<?xml version="1.0"?>
<contentrules purge="True">
<rule name="exclude-on-add" title="Images are excluded from navigation when added"
description="" enabled="True"
event="zope.lifecycleevent.interfaces.IObjectAddedEvent"
stop-after="False">
<conditions>
<condition type="plone.conditions.PortalType">
<property name="check_types">
<element>Image</element>
</property>
</condition>
</conditions>
<actions>
<action type="sc.contentrules.actions.ExcludeFromNav">
<property name="exclude">True</property>
</action>
</actions>
</rule>
<assignment name="exclude-on-add" bubbles="True" enabled="True" location="/your-container"/>
</contentrules>
You have the options for Navigationin the Site Setup menu.
Remove the tick on image for displayed content types and images are not longer shown on site navigation and site maps.

Add css to only homepage from xml in magento

Want to include css file which is applicable to only homepage from xml file.
Tried this :
<cms_index_index>
<action add css>
.
.
</action>
</cms_index_index>
using this in local.xml adds that particular css in every cms page.
Any Idea ?
Thanks in Advance.
In the cms home page there is Design(Layout Update XML)
use the following code in that
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/myjavascript.js</name></action>
</reference>
this solution work for me
<cms_index_index translate="label">
<label>CMS Home Page</label>
<reference name="head">
<action method="addCss">
<stylesheet>
css/custom.css /*This is ur css path*/
</stylesheet>
</action>
</reference>
</cms_index_index>
Try this
<cms_index_index>
<reference name="your cms identifier for home page">
<action method="addCss"><stylesheet>your path/your css file name</stylesheet></action>
</reference>
</cms_index_index>
Please use this code in local.xml or page.xml
Am not 100% sure about the code work or not
In combination with #Leo's answer as well as another blog post I found recently, here's a code snippet to add custom css to just a single page only.
<reference name="head">
<action method="addCss">
<stylesheet>css/custom.css</stylesheet>
</action>
</reference>
Same instructions as #Leo mentioned.
The above suggestions didn't work for me in Magento 1.7, blank theme. What worked was this:
<reference name="head">
<action method="addCSS">
<type>css/master.css</type>
<stylesheet>media="all"</stylesheet>
</action>
</reference>
This produced the following code
<head><link rel="stylesheet" type="text/css" href="http://myshop.com/shop/skin/frontend/mytheme/blank/css/master.css" media="all"></head>
I placed this code into the local.xml of my theme.

Alfresco 4.0d Custom Aspect Search

I'm currently developing a custom search in Alfresco for some custom aspects that I've created . Can you direct me to the correct xml file which I need to edit to add my custom aspects in the search? I have researched numerous posts on the web but I couldn't find anything...
Explain better,
do you mean the default advanced search in Alfresco Explorer?
In that case, you should search for a file named web-client-config-custom.xml.sample inside:
/Alfresco/tomcat/shared/classes/alfresco/extension
or
/Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/extension
Then rename the file removing the sample extension, to have web-client-config-custom.xml and copy the file inside the first path above (the "shared" one, not the webapps/alfresco one);
Then, inside, search for a tag named "config evaluator" Advanced Search, it should be something like this:
<!-- Example of configuring advanced search -->
<!--
<config evaluator="string-compare" condition="Advanced Search">
<advanced-search>
<content-types>
</content-types>
<custom-properties>
<meta-data aspect="app:simpleworkflow" property="app:approveStep" />
</custom-properties>
</advanced-search>
</config>
-->
There, you can add your custom aspects that you created in your customModel.xml file.
To extend the custom advanced search capabilities, you could add some custom content type search or properties that are not part of the aspects, like this:
<config evaluator="string-compare" condition="Advanced Search">
<advanced-search>
<content-types>
<type name="myNamespace:customType" />
</content-types>
<custom-properties>
<meta-data type="myNamespace:customType" property="myNamespace:customTypeProperty" />
<meta-data aspect="myNamespace:customAspect" property="myNamespace:customAspectProperty" />
</custom-properties>
</advanced-search>
</config>
hope it helps..

The Facebook comment box, does not work correctly with URL Rewriting?

I would love to use the Facebook comment plugin in my webpage, but it does not work correctly with UrlRewriting.net.
I added the comments code in my webpage (that is generated dynamically and uses Url-Rewriting) and noticed that the comment (that should exist only to the specific page) is visible-available to all the webpages that have the same rewrite rule.
UPDATE: The Rewrite rule is
<add name="Rule1" virtualUrl="^~/temp/(.*)/(.*).aspx"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/Directory/page.aspx?ItemID=$1&id=$2&lng=gr"/>
To use correctly that facebook social plugin, you simply need to provide a unique string for each of your pages.
That being said, the URL is not mandatory. If, for example, you have an unique numeric/ alphanumeric/ whatever ID for each page, you could simply have the href
href="MySiteName+ID"
no need to have href="http://mysitename.com/whateverpage/etc/etc/etc/".
In my opinion it's actually better to do it like that because if you're tempted to just dump the URL dynamically, the actual URL might change without your notice, eg.
http://example.com/pages/about-us is A DIFFERENT URL from http://example.com/pages/about-us?comment=43&page=4 and, in consequence, shall have a different Comment Feed from facebook. ( aka comments where href="pages/about-us" won't be related to comments where href="pages/about-us?comment=43&page=4" )
Your page URL must have a query string that make the URL unique
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#appId=<?php echo FACEBOOK_APP_ID; ?>&xfbml=1"></script>
<fb:comments href="PAGE_URL.'&**uniqueID=uniqueID**" publish_feed="false" num_posts="2" width="430" height="52"></fb:comments>
EDIT
You can pass make your URL something like
<add name="Rule1" virtualUrl="^~/temp/(.*)/(.*).aspx?data=(.*)"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/Directory/page.aspx?ItemID=$1&id=$2&date=$3&lng=gr"/>

Resources