Creating a page on CMS - content-management-system

For example:
I create a page on Joomla or Wordpress and then save it.
I create an entry in the menu that points to the new page.
When I select the new entry in the menu the page opens on the browser.
The URL that appears points to a file that doesn't exist on the server.
What is the mechanism that is used by a CMS like Joomla or wordpress to accomplish this?

This is typically done with a URL rewriting module that runs on the web server (mod_rewrite for Apache or URL Rewrite for IIS on Windows). It will rewrite a request URL like /blog/article-title to something like /index.php/blog/article-title or /index.php?q=blog/article-title before the website code even sees the request. Then, the code in index.php extracts the rest of the path and determines which content to serve based on that.
For Wordpress, see http://codex.wordpress.org/Using_Permalinks for some info about how the rewrites are set up.

Related

Apache2: Redirect from a custom link to a html file

That's quite a simple question, but I would like to create a redirection for my website using Apache2 and the virtual hosts.
I want it to happen when a user gets on this link : https://somewebsite.com/test
And this link should redirect to an html file in my website directory (for example test.html) with the link still on https://somewebsite.com/test
I think I should use mod_rewrite or the aliases but I don't know how to use them.
Thanks for your time !

How do I rewrite URL to drop file extension for pdf on github pages?

Imagine my website is hosted on GitHub Pages and has a custom domain website.com. I can access a pdf at website.com/mypdf.pdf
Is there a way where I can make it work at website.com/mypdf?
As mentioned in comments, if you are using static website hosted by a 3rd party like GitHub pages, you don't really get a lot of control over http server. I would tentatively say you cannot control URL rewrite rules on GitHub.
What you could potentially do instead is to host a page with a bit of JavaScript that would start the download on a given event (button click, page load, etc) this way you could mask your actual download URL with this html page (that by convention comes with no file extension)
UPD: and surely enough someone's been doing it already: http://lea.verou.me/2016/11/url-rewriting-with-github-pages/. The post is going on about having nice urls, but I believe file downloads implementation can be implemented similarly
Yes you should make your website with MVC structure. Make a controller and in Index action load pdf file.
Then on action calling your pdf will be loaded like that:
Students/AllResult etc

Redirects in Ektron 8.6.1

Has anyone played with the new redirect feature in Ektron 8.6?
We tested it (in 8.6.0) before upgrading and were happy with it. But when it came time to do the upgrade, Ektron had released 8.6.1, so we upgraded directly to that.
Now we are having trouble with the redirect feature. (Yes, we should have tested everything again in 8.6.1 before upgrading)
Now if we try to add a redirect rule for an existing page in the CMS, it does not work.
But if we create a redirect rule for a page the does not exist, then try to hit that address, the redirect works fine.
We need the redirects to work for existing pages in the CMS.
To clarify what "working" and "not working" means...
If I have an existing page in the CMS with manual alias of "/erc/lucien.apsx", I can create an entry in the redirect table like this...
Adding this entry generates no errors, but when I visit the page, all I see is the regular old page I created. NOT the Google site it should be redirecting to. I do not get any 404 errors.
But if I create a redirect entry for a page that does not already exist, like this...
It works perfectly. If I try to visit the /erc/fake.apsx address, I end up on the Google site, as expected.
(FYI, we create a "fake" page in the CMS for external content so we can attach metadata to it and make it searchable in taxonomies, but then provide a link to the "real" page. I want to use redirects here so users don't have to do this extra click)
I suspect it might be cache related -- the original URL gets cached as an alias, then subsequent requests to that URL are redirected to the quicklink without the need for a db look up. When you add the redirect, it’s probably not clearing the old item from the cache. I'd try an IIS reset after you add the URL redirect and see if that clears up the issue.
An "outside the box" (of Ektron) answer to this is to place the redirect at the web server rather than in the Aliases section of the Ektron CMS.
The server I work on uses IIS and I have this set up for several pages.

Creating a redirect in IIS6

I need to create a redirect from www.domain.com/page to another page in a different domain. I need the first (referring) url to have no extension (meaning no .html or .asp).
I know how to do it in Apache, but have no clue how to work with iis6.
Is there any simple way of doing this?
Here is an easy solution:
Create a folder for your website www.domain.com and then another sub folder for "page".
Create a website in IIS manager for www.domain.com
Expand that website, and then right click on your "page" folder, choose properties.
On the directory tab, choose the option: A redirection to a URL put the full domain of the target location. You may also want to examine the check boxes below it if that fits your needs.
Another option that you could do outside of IIS is setup your website, and take advantage of the "default document". if you add an index.html file into your website at http://www.domain.com/page , the default document will be called automatically without referencing the index.html in your path and you can do a javascript redirect.
<script>
window.location='http://www.someothersite.com/page.html'
</script>
This may be easier when dealing with a large number of pages.

How to redirect 404

For example in past my website look like this:
Example: www.mywebsite.com/keyword
Now look like this:
Example: www.mywebsite.com/search.php?q=keyword
How can i redirect people who search for a specific tag to my new link?
From "www.mywebsite.com/keyword" to "www.mywebsite.com/search.php?q=keyword"
I'm not so good with coding so based to my examples can somebody make the code that need to be inserted in htaccess file pls.
This are the examples of links:
OLD: www.mywebsite.com/keyword
NEW: www.mywebsite.com/search.php?q=keyword
That redirecting is called URL Rewriting, and is usually done via a .htaccess file for Apache, or with magic if you're using Lighttpd.
I would take a look at this website, which more or less explains how to do it (assuming you're running Apache): http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html
The specific details depend on the web server being used (IIS, Apache, etc.) but basically you could configure those to redirect to a specific web page and extract the keyword from the original URL and place it in the query string parameter list.
For example, in IIS you would do the following:
Start > Programs > Administrative Tools > Internet Services Manager
Select your web site from the list and right-click to go Properties.
The Custom Errors tab is where you will see a list of HTTP errors.
Select the "404" page and "Edit Properties" to point this to a web page of your choosing.
The last step is where you will plug in your custom code that will handle the redirect.