how to change the homepage to a custom page in Orchard - orchardcms

I have a custom view page created, how can I make this page the home page?
I tried going into Orchard.Alias, but didn't figure out the way to fix this. Can you please let me know an easy solution?

Enable the feature Alias UI and go to that. The homepage route is blank (or possibly a single slash, I forget). So point your custom route (from a controller I assume) to that homepage url in the Alias UI.

This could be done in two ways:
Enable Autoroute module, then edit you page and set it as homepage. ( can be changed later from cms - but it is plain html)
In the current theme, in views folder create a new file named Content-Homepage.cshtml and drop your code there( hardcoded - but can make use of Controllers)

To change default url, you need to enable Alias UI module,then go to alias module, you will find an alias with a slash then click on edit. Do not write write anything in alias path, you need to change in Route Path. There you need to write the path you need to call when the site runs. You need to start from module name to the action method you want to call.
e.g. Users/Account/LogOn
Here Users is the module name, Account is the controller name and LogOn is the action name I have called.

Related

IIS - ignore/deny access to specific pages

I have hosted an asp.net project in IIS and I want to restrict logins to some pages/folders.
I want to restrict all the users to not open some directory files using url.
They have to be able to only access the localhost/mypage/home and localhost/mypage/login. but if I try something like: localhost/mypage/resources/importantNotes.json everyone can open it! So I want somehow to redirect/deny access to it.
Also I want to not "totally" ignore that typical path because I need that resources folder later in my code.
What I have tried:
HTTP-Redirect, this works well, it redirects to specific page but I loose total access to the files I have on that specific path!
I have also tried with filteringRules but still the same result, I loose total acces to that specific resource folder!
What should I try or what am I missing here?
Below is the approach to block accessing folder and its contents using the URL Rewrite module.
You could select your site, open the URL Rewrite module.
Click the Add Rules option, select Request Blocking rule template and click the OK button.
Set * as pattern.
Set {REQUEST_URI} as Condition input. Set /test_folder/ as pattern. You could modify it and specify your own folder name here.
Set Custom Response as Action type. set Status code as 403.
click the Apply button and restart the site.
Output:
To block files in the folder, you need to set the pattern as /test_folder/*.
Output:

Liferay Top Level Friendly URL

Is there a way to create / process friendly URLs in liferay like this?
http://myserver.com/JonDoe
... where John Doe is the name of a clients whose data should be displayed.
A little more detail:
I am not talking about getting rid of the "web" or "group" for friendly urls, I am taking about having a friendly url right after the first "/".
We want to create URLs in the form of http://server/ClientName where ClientName resolves to the name of a Client. This is an issue since normally liferay would expect a friendly URL after the first "/". So we ned to intercept that somehow.
The process should be like this (pseudo code):
1) inspect values after first "/"
2) If value after "/" is the name of a client, send user to client display page and display client information
3) If there is no client with the given name, interpret it as friendly url and do normal liferay behaviour.
Is there a way to do this in liferay ?
Sounds like you want to get rid of the /web/ or /group/ parts of the URLs? This is possible with proper configuration of the virtual host - you'll map the site to the domain name, then you have total freedom to name the pages, even hierarchically (e.g. /JonDoe/home)
So far this was simple configuration. If you want /JonDoe to point to another site than /JoeShmoe (e.g. just get rid of /web/ or /group/), you'll have to dig deeper and write quite some customization plugins that change the name resolving (and generation of URLs)
If you want to have one URL for a page, you can just set the friendly URL for that page (see Olafs remark about virtual hosts as well)
If you want to have a limited set of URLs for one page, you can create a page of type Link to Page for each URL and select the original page. To identify the current URL when rendering you portlet you can use PortalUtil.getCurrentURL(renderRequest)
If you want to have many URLs for one page you could use a FriendlyUrlMapper, which allows URLs like http://myserver.com/page/-/myPortlet/JonDoe.
If you want to have many "root" URLs (i mean without the /page/-/myPortlet part), you will have to create an Liferay EXT plugin, extend com.liferay.portal.util.PortalImpl and overwrite getPortletFriendlyURLMapperLayoutQueryStringComposite. I've done the same by implementing a strategy that checks if a page exists for a specific given URL and otherwise uses the URL as parameter for a FriendlyURLMapper.

codeigniter controlled access to a url/folder

I am stuck at the situation where I want the url, which contains a folder having some files (html, swf etc.), to be accessible after I validate the user.
For example.
The url to access is:
A - http://mysite.com/files/version/1/file.swf
And this above url is accessible from the link,
B - http://mysite.com/view/1
I have implemented a way to hide the URL A from a normal user but if the user somehow is a semi-techie person then he can know the swf file location from firebug or other tools. So, to make the access-to-file secure what should I do?
If a user somehow knows the first url(A) and then enters it in browser, i have to check if the user is logged-in and if validation is done it lets the url A to be loaded.
Since, in CI, the controller names cannot be named same as the folders in the root directory, in this case i cannot have a controller called “files”. So, the only option left to make this secure access to url work is to use htaccess rule/cond. If this is the only option, then how can it be achieved by htaccess and if not, then what other options do i have.
Will the codeigniter's URI Routes work because when i tried like this:
$route[‘files/version/1/(:any)’] = “view/$1”;
and it doesnt work, maybe because there is no controller/function/param as files/versions/1 ...
looking for quick help. Thanks
There isn't a sure-fire way to do it without, for example, using .htpasswd.
One thing you could implement is sort of "Security by Obscurity". In that case you could redirect all requests to a file to the URL http://mysite.com/view/file-id and then instead of loading the requested file directly, you would load a .php template with the appropriate headers - be it an image, a flash file or anything else.
But it really depends on how the files are going to be managed, since every file will need an entry in the database and you would have to output different headers for different types of files. And if someone still manages to guess the path to the file, it will be directly accessible.

Redirect URL in Orchard after user login?

How to redirect the page when user logged in Orchard?
I want to redirect to my own module's page with user's credential.
I tried to add a HTML action link in Orchard.Core.Shapes/Views/User.cshtml to redirect to my own moudle, but it doesn't work.
it seems the page doesn't refresh in this approach.
What 's the better way of doing this ?
An action link is not going to redirect, it's just going to create a link in the page. It's not quite clear what you are trying to do. If you just want to change the layout, override the template. If you want to take over controller logic, I'd recommend creating the same route, with higher priority, pointing to your own replacement controller.

Drupal url alias and views and clear urls for taxonomy issues

I am using views module. I have created blocks using views and a url using page display. This is for taxonomy. So my views url looks like this "news/science" So if someone click on the link he should be taken to www.example.com/news/science. However i am taken to a unstyled page with broken links. But when i try to use the url www.example.com?q=news/science i am taken to a proper page with correct data.
The issue is only with taxonomy related terms.
i.e all urls www.example.com/news/technology , www.example.com/news/sports appear broken and unstyled however if i manually visit www.example.com?q=news/technology and www.example.com?q=news/sports i am taken to a proper page.
Can anyone suggest what could be the reason.
The same issues is with admin login and logout. If i use www.example.com?q=user and try to login i can login. Also if i use www.example.com?q=logout i can logout. But if i use clean url aliases ie. www.example.com/logout then i am taken to access denied page.
Do you have the Path module enabled? Thats the module responsible for mapping ?q=logout to /logout.
See here: http://drupal.org/handbook/modules/path
Have you changed anything in .htaccess? any mod-rewrite changes that might be skipping over those particular urls?

Resources