How can I use two resources with the same alias (modx)? - modx

I am using friendly URLS, but Modx doesn't allow to use the same alias name, even if it is in another folder, like for example:
http://www.mypage/friends/blog
and
http://www.mypage/community/blog
is not possible. I get the error message:
Resource is already using the URI
Can somebody help me?

In System Settings make sure Use Friendly Alias Path is set to Yes.

Related

URL redirect when accessing domain

is the first time I'm using IIS (Windows Server 2019) and I'm looking for a configuration to be able to redirect clients from http://mysiteExample.org/ to http://mysiteExample.org/embed.html?key=val. I considered that URL Rewrite Module could help me to achieve this (as is not necessary for the clients to see the new URL they'll be redirected to). I made the configuration as shown in this screenshot, where I set '^$' as a pattern to specify this should apply for cases where no URL string is provided.
Could somebody with more experience advise me on how to achieve what specified above?
Thanks in advance
I finally managed to make it work changing the action type from 'Rewrite' to 'Redirect'.

how to change the homepage to a custom page in Orchard

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.

How to prefix all requests with ~username?

I'm testing moving my site to a new Linux server using cPanel which requires you to put in your IP and username (e.g. http://123.xxx.xxx.xxx/~username/). The problem is, all my image/JS/CSS links use paths like /css/style.css or /images/picture.jpg so none of the styles, scripts or images show up properly.
How do I set up a RewriteRule to prefix ~username to all requests?
Before moving site, if it was working with only domain name and with redirection then now it should also work with server IP and username, Make sure the permissions and ownership of /css/style.css or /images/picture.jpg are correct.
Also check it once adding exact path manually like 'http://123.xxx.xxx.xxx/~username/css/style.css'.
I was able to get around the issue by setting the domain to a dedicated IP instead of shared, so I could access the site using 123.xxx.xxx.xxx instead of 123.xxx.xxx.xxx/~username.

Symfony2/ get variable from subdomaine and htaccess

I using Symfony2.
What would be the best practice to get a variable from URL. I am using subdomain to get the city.
Ex: paris.website.com
how do I get Paris as variable.
I believe I need to play with Kernel and htaccess, but I haven't figured out how.
Thanks if you can put me on right tracks about that.
Cheers,
Pierre.
You should read the documentation of Symfony. One of the basis components of Symfony is the Routing that provides exactly what you need :
www.mysite.com/paris/
Using the subdomain is not the solution, but you can play with .htaccess to rewrite subdomain paris.mysite.com to www.mysite.com/paris (if web server allows it) after having configured your route in Symfony.

Best way to password protect a site? .htacess

I created/edited a .htaccess file and I got my site password protected fine. Question though: Is there such thing as a URL key? Maybe I'm wording that incorrectly, but I would like to keep my site hidden, but be able to send out a specific URL that can view the site. What's the best way to accomplish this?
Thanks in advance.
If doing as Greg suggests and putting it in a folder isn't good enough for you, you could set the .htaccess to rewrite all url's to a php file (or whatever language you are using) and it checks some sort of database (or xml file or whatever format you want) for a key or parameter in the URL, and if its not there it can return a 404 in the header. That way unless they guess the url exactly it will return a 404 like there's nothing there.
And be sure to turn virtual directory listings off too.
Simply put your site in a directory that's using a "secret" name:
http://example.com/opensesame/
If you don't link to that, then it will be "hidden" unless you give out the URL.
Naturally, this doesn't protect against other people publishing your "secret" URL and linking to your site anyway.

Resources