I tried to use option in iis7 Enforce lowercase URLs, but when i enabled it all images that had *.JPG extension (uppercase) stopped server. in prev version of iis it was ok when using upper and lower cases, it returned same source
may i fix it? or should i create rule for each extension like (jpeg, jpg, gif...)
I was just reading an article on writing rules, from Scott Gu
Tips/Trick: Fix Common SEO Problems Using the URL Rewrite Extension
He talks about the issue of excluding static files (.jpeg, .jpg, .gif, etc.) from the lowercase rewrite, and shows how you can add conditions to exclude files. Another article is where I found the condition for excluding more than just Scott's example
Mike's Umbraco blog - URL Rewriting and SEO
He adds the condition:
<add input="{URL}" pattern="^.*\.(axd|css|js|jpg|jpeg|png|gif)$" negate="true" ignoreCase="true" />
I hope this helps you in future rewrites.
Related
I have one project for publishing two separate websites on different servers. Both websites is in different languages (En and tr).
For web-deploy I want to change appsettings for different environments for Debug and Release (For both websites).
I added config files for transformations like this:
Appsetting in main Web.config:
<add key="WebsiteMainCulture" value="en-US"/>
The code in transformation files are accordingly like this:
<appSettings>
<add key="WebsiteMainCulture" value="TR"
xdt:Locator="Match(key)" xdt:Transform="Replace"/>
</appSettings>
I selected Web.TR.Debug.config and ran project, But I always get 'en-US' as WebsiteMainCulture.
string website_main_culture = ConfigurationManager.AppSettings["WebsiteMainCulture"].ToString(); // always en-US
Please help. Is there any better approach suggested for same environment?
Thanks!
I got the solution for the problems I asked, also related to my previous question here:
https://stackoverflow.com/questions/30612865/selecting-correct-seed-method-for-particular-language
I just added config transformation files by right clicking, to relevant publish(web deploy) files.Then added desired values to keys. And it worked.
Here are config transformation file auto generated.
Given the following example manifest:
CACHE MANIFEST
# v1 2011-08-14
# This is another comment
index.html
cache.html
http://somedomain.com/abc/xyz/
/style/css
controller/view/1
# Use from network if available
NETWORK:
/api
# Fallback content
FALLBACK:
/ fallback.html
Will "/style/css" and "/controller/view/1" work, or does it require actual file names? I keep reading about putting "files" there, but on other sites I read "URI". I'm assuming URI is correct. So, are full AND relative URIs allowed? Any cross-browser/device issues to be aware of?
BTW 1: Yes, I'm aware that "file names" are just part of a URI, and names don't dictate content (image.png could download a text file, for example, if one wanted to). I only want to confirm that URIs work well in the CACHE MANIFEST section, thanks.
BTW 2: I'm aware that Mozilla states URI for the cache manifest, so as mentioned, I just want to confirm.
https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache
You can use a dynamic manifest file which is actually designed to work with MVC. I've not had chance to use it myself but it looks really good!
http://deanhume.com/home/blogpost/mvc-and-the-html5-application-cache/59
I have a simple Camel Route which processes the incoming Http request and then routes to other Http consumers based on the Resource path. Everything works fine but I hit the java.net.URISyntaxException: Illegal character in path when used a space in the path.
Other special characters seem to work fine.
I am building a RESTful APIs and currently using the browser to test my APIs.
Here is the Spring DSL of my route:
<route id="API">
<from uri="jetty:http://0.0.0.0/api?matchOnUriPrefix=true"/>
<bean ref="basicAuthBean"/>
<choice>
<when>
<simple>${in.header.CamelHttpPath} contains 'blah1'</simple>
<to uri="http://localhost:10001/api?bridgeEndpoint=true&throwExceptionOnFailure=false"/>
</when>
<when>
<simple>${in.header.CamelHttpPath} contains 'blah2'</simple>
<to uri="http://localhost:10002/api?bridgeEndpoint=true&throwExceptionOnFailure=false"/>
</when>
</choice>
</route>
I enabled trace on the Camel Context and found that the CamelHttpPath had already replaced the escape character "%20" with a space. I also saw that there was CamelHttpUri which had not escaped the special character.
As a hack in my Spring DSL I added the following before the choice element:
<setHeader headerName="CamelHttpPath">
<simple>${in.header.CamelHttpUri}</simple>
</setHeader>
This solved my problem but I am pretty sure there is a better way to do this. Did I miss setting some properties or is my route DSL not accurate?
Also, what is the difference between the CamelHttpPath and CamelHttpUri?
I should also mention that I am using the Camel Context in Apache ServiceMix 4.4.2 and the Camel Version used is 2.8.5.
Thanks in advance for the help!
I think we have fixed this in later Camel releases due to be released like Camel 2.10.4 etc. I remember working on that space fix.
https://issues.apache.org/jira/browse/CAMEL-5504
As Camel 2.8.x is no longer supported you would need to patch the issue yourself.
Or upgrade to ServiceMix 4.5.0 which includes Camel 2.10.3.
my site uses JSF and the url appears to be, http://mysitename.com/wompower6/faces/home.xhtml
I am using prettyfaces, so if I use the following in pretty-config.xml, i can change the name to http://mysitename.com/wompower6/home
<url-mapping id="home">
<pattern value="/home" />
<view-id value="/faces/home.xhtml" />
</url-mapping>
my questions are
how can i remove the application
name wompower6 , so that the url
becomes mysitename.com/home ?
in my web.xml, i have
<welcome-file>home.xhtml</welcome-file>,
but this does not seem to work. When
i type, mysitename.com, it does not
get mapped to home.xhtml. any clue
here?
how can i remove the application name wompower6 , so that the url becomes mysitename.com/home?
This is a webapp <Context> setting and configuration is dependent on the servletcontainer used. If you're for example using Tomcat, then there are basically 2 options to make your webapp the root webapp.
Rename the WAR file to ROOT.war and Tomcat will by default deploy it on context root.
Set path attribute of <Context> element in Webapp/META-INF/context.xml (or Tomcat/conf/server.xml, depending where you'd like to define it) to an empty String. E.g.
<Context path="" ...>
Other containers support similar constructs. Consult their documentation for detail. If you're using an IDE like Eclipse, then you can also set it in the Web Project Settings property of the project properties (rightclick project and choose Properties). Set the Context root value to just /.
in my web.xml, i have home.xhtml, but this does not seem to work. When i type, mysitename.com, it does not get mapped to home.xhtml. any clue here?
I assume that you're talking about the <welcome-file> setting. This has to point to a physically existing file, not to a virtual URL, such as /faces/*. There are basically two ways to overcome this:
Provide a physically existing /faces/home.xhtml file (it can even be left empty).
Replace the ugly /faces/* URL pattern of the FacesServlet mapping in web.xml by *.xhtml so that it will just kick in on every request for a XHTML file.
<url-pattern>*.xhtml</url-pattern>
This way you don't need to fiddle with /faces/* URL patterns.
I'm almost finished developing my large project, however I would love it if I could make it so instead of having the users profile pages at: http://example.com/profile/username/USERNAME
(i'm currently using .htaccess to rewrite the GET data into forward slashes and profile(.php) being read as just 'profile' profile.php also parses the url correctly to retrieve the GET data)
But it would be some much better if I could do it so that it's like http://www.example.com/USERNAME (preferred) or http://www.USERNAME.example.com
Any ideas or resources?
Thanks,
Stefan
In your .htaccess in the root, add
RewriteRule ^/([^/]+)/? /profile/username/$1
This matches paths that don't include a slash (so no directories in the path) and suffixes the path to /profile/username/. The path can include an optional final slash.
(+1 for the comment about namespaces - it's a little dangrous having usernames in the root of your site. I've tried to limit the impact of this by only giving out the namespace comprising a single directory. Paths with multiple directories will be handled as normal.)