Creating a custom url for an static html page - .htaccess

I need to create a page like http://www.example.com/strong and the file to support that are inside my docroot/strong/index.html.
Inside my docroot there are other folders with their index file as well. For example
docroot/site1/index.html
docroot/site2/index.html
docroot/strong/index.html
So when user types in http://www.example.com/strong it should open docroot/strong/index.html without changing the URL. Can I achieve this?

Related

Why URL's "path" such as index.html was hidden?

In modern Website usually hidden path.
use this
https://google.com/main
instance of this
https://google.com/main.html
but I want to ask why they chose to hidden the file path.
I know that Initial web was use this file path.
But if they chose to cover up it, I think there was some reason.
Because of they just think it doesn't look good?
Or is there a security issue when using a file root?
in tranditional website.all content on the page is static and write in html file.so we can fetch and show the page directly by browser.
in modern internet,the content we browse is dynamic,for example we browse a news page,the content changed every second,so the server handle our request by some function not handle by a static html file,the function always print out latest news,so it is dynamic,not a unchanged static html file.

Custom search result page in shopware5

I need to create a custom search result page for my Shopware site. As I know custom pages can be designed only for detail and list pages.
However, after creating custom list page for my site with the name of “custom_listing.tpl” my search result page is still looks like the default list page of the site. How can I get rid of this default list page template on my search result page?
I tried to change the fuzzy.tpl {include file='frontend/listing/listing.tpl'} to my “custom_listing.tpl” but that did not work.
What you need to do is to create your own theme/template and activate it in the Shopware backend. Further you need to create your own frontend/search/fuzzy.tpl in your theme folder.
Now let your own fuzzy.tpl extend from the original one like so:
{extends file='parent:frontend/search/fuzzy.tpl'}
After that you will have access to all the smarty blocks that are defined in the parent fuzzy file and even in the frontend/index/index.tpl of which the parent fuzzy extends from.
Make your changes, deploy it to your localhost or webserver and after clearing the cache the search controller should autoload the overridden fuzzy.tpl with your custom search results layout.

Orchard - access a content type through different URLs so they use different views

I'm trying to create a CSS documentation library in Orchard. I want to save a description, CSS snippet and HTML snippet against each content type. The first view would show the description and CSS and HTML code written out. The second view would show a preview of what the CSS and HTML look like rendered.
cssdocumentation.com/content/item1
cssdocumentation.com/content/item1/live-preview
I've created the content type and the first view. But I'm not sure how to create the second view. I can see if I can create the alternative URL I can use the Url Alternates module to create an overriding .cshtml
To create an alternative URL I've looked at the autoroute module but this only allows you to adapt a single URL (unless I'm missing something?) and I've looked at Alias UI but this forces me to manually create an alternative URL everytime I create a content item.
Is this possible in Orchard without writting too much C#? (I'm a frontend developer so I only dabble in the behind the scenes stuff)
Thanks for any help
Best solution is to do this within your own module. But as a secondary option instead of having a second page, combine this content with your first page and hide it with CSS. When the user clicks a button to navigate to the next step render the CSS/HTML result on the same page. You can do this in many ways, here are a few ideas:
Render the CSS/HTML result out straight away on the same page but hide it. Show it when the user clicks a button
using jQuery to render the result on the client side. More dynamic if you allow editing of the HTML and CSS.
Redirecting the user to the same page with specific url parameters which you can pick up in your alternate to modify the output.

Display image from some server directory

I save uploaded image files in tomcat or portlet temporary directory, and I want to display them. I know their path in server file system, but how generate a right path for displaying it on portlet's page? It must become from smth like:
opt/liferay/tomcat-7.0.27/temp/28-Image-portlet/WEB-INF/classes/intech/webpro/kegor/image/Clipboard02.jpg
to
http://test.com/web/guest/liferay-benefits?p_p_id=Image_WAR_Imageportlet&p_p_lifecycle=2&p_p_state=normal&p_p_mode=view&p_p_cacheability=cacheLevelPage&p_p_col_id=column-1&p_p_col_count=1&_Imag
How to get it?
I know how it is done from portlets resources folder:
#{resource['images:smiley.jpg']}
But how to display image from some server directory in portlet?
You can't access images from another server using #{resource['image']} ,
You can either
1) give the full image path in xhtml
2) Keep the image paths in CSSfile and use CSS classes in xhtml.
3) create a common util function or
ResourceHelper ApplicationScoped Bean that has something like
getResource(String imageName) which returns the correct URL. You
can then use it in your xhtml as
#{ResourceHelper.getResource('image.png')}
If you only need to display content (without permission check), you can use Tomcat. Put file into /webapps/portlet-name/html/ (or temp/portlet-name/html/) directory.
As a result: http://site.com/portlet-name/html/image.jpg

Can I link to an HTML file in my project from a UIWebView?

If I load a string containing HTML into a UIWebView, and that string contains objects (hyperlinks) that are relative to that string, i.e. , where there is some object with id "something," then the link works - click on it and the web view jumps to the referenced object.
What I want is to get navigation to a different file in my project, in other words as though the path to the different file were a URL.
I have found that if the href IS a URL, such as href="http://www.amazon.com", then the link works.
If I put the name of a file, OR the [NSBundle mainBundle] pathForResource: ] of that name, in the href, then the link does not work.
Is there some way I can generate the equivalent of a URL pointing to an HTML file that is in the project, so that an can link to that HTML file?
I found a solution at this link:
How to use Javascript to communicate with Objective-c code?
Essentially, the solution is to implement the UIWebViewDelegate protocol's shouldStartLoadWithRequest method, and "trap" a particular value of scheme. So my links, instead of saying something like:
<a href="http://someplace.location">
are like:
<a href="mylink://#filename.ext">
By catching attempts to load anything with scheme "mylink," I can use:
[[request URL] fragment]
within shouldStartLoadWithRequest, and get the filename.ext. I then release my previous UIWebView, load in the contents of the specified file, and make that the contents of a new UIWebView. The effect is that the links work with normal appearance, even though they are being implemented with my code. I return NO because I don't want the usual loading to take place. If the scheme is NOT mylink, I can return YES to allow normal operation.
Regrettably, I still have no way to jump TO a fragment within a web view. In linking to a real URL, you can say something like "www.foo.org#page50" and jump straight to wherever an object on the new page has an id of "page50." With my method, I can only go to the top of the page.
This is also not going to give me a "go-back" function unless I record the filenames and implement it myself.

Resources