I am trying to put redirect links on Protege IRI. I am trying to do the same as this tutorial explains. I am trying many hours/days to make this work. https://linkingresearch.wordpress.com/2016/01/17/permanent-identifiers-and-vocabulary-publication-purl-org-and-w3id/ Ok, I have understand what I do with the github links. But what should I do with the redirect links on IRI on Protege? What I do with them? Where do I put them on the .htaccess file?? Somewhere else?
The examples in the tutorial seem straightforward to me.
You start with an ontology file and a place in the web that you control, e.g., the URL of your GitHub repository. Call the URL U and the ontology file F.
Your ontology file contains an ontology, which you wish to have a stable URL no matter where it's hosted. So, F can be downloaded at U but you do not wish people to have to know U, you want them to know https://w3id.org/PATH/NAME as a nice, abstract way to refer to your ontology. So, the content of F says that the ontology IRI is https://w3id.org/PATH/NAME
You fork the project in order to be able t create a pull request; in the forked repository, you create the folder PATH (ensuring it's a path that does not already exist). You place an .htaccess file in the folder PATH.
In the .htaccess file you add a rewrite rule for NAME (I know nothing f HTTP rewrite rules, I'm just reading the example file) and enter U - so that a browser will attempt to connect to https://w3id.org/PATH/NAME, and this portion https://w3id.org/PATH/ will let the browser find the .htaccess file.
Here the rewrite rule will be applied and https://w3id.org/PATH/NAME will change to U, and then the content of F will be downloaded.
You need the administrator to accept your pull request for https://w3id.org/PATH/NAME to work; if that does not happen, then the URL in your fork would still do the job - and you can use this as an experiment to make sure your .htaccess is working as you wish it to. E.g., my fork is at https://github.com/ignazio1977/w3id.org, so I could use https://github.com/ignazio1977/w3id.org/PATH/NAME to redirect to U.
Related
It is my first time seeing something like this.
Does anyone know, what the name/kind/type of the website is that does not have any kind of subdirectories on the web-URL page, and it always just stays as a plain domain name, and how it was made, and how it can be avoided since I need to send an API call to one of those subdirectories?
Example:
I have a website let's call it example.net. It has UI page and it has a home page, which should look like this in a browser: example.net/home, or it has a /shipment option inside of the UI page. So the URL should look like this:
example.net/shipment and it has one more subdirectory inside for example /report, and if I select it, it should look like this: example.net/shipment/report (something like this).
And open up that subdirectory, but again web-URL link on a website continues to stay just as a example.net all the time.
And for some reason whatever subdirectory I would go on a website, Web-browser URL will remain as a hello-world.net all the time without any kind of changes subdirectories on a web-browser URL.
It is an internal website, so I can not post examples of it from work here.
Does anyone knows, what the name of that kind of set?
How it can be avoided? Since I need to send an API request to one of the subdirectories?
I am not a developer, and I am new to IT, so I am not really sure, what the name of this, and how does it works.
If you are on example.net/shipment and you want to link to a subdirectory, the link needs to include that subdirectory. You have two possibilities:
Root relative links: <a href=/shipment/report>
Absolute links: <a href=https://example.com/shipment/report>
If you shipment directory has a trailing slash (example.net/shipment/), you a third possibility. (Note this only works with a shipment URL that is different than what you specified in your question.)
Document relative links: <href=report>
There is no name for websites that don't have subdirectories that I know of. Websites are often set up like this to make the URLs easy to type and remember which helps with SEO.
I have these three links:
localhost/my_projects/my_website.php
localhost/my_projects/my_website.html
localhost/my_projects/my_website
The paths of the php and html files are as follows:
C:\xampp\htdocs\my_projects\my_website.php
C:\xampp\htdocs\my_projects\my_website.html
The link without an extension is "artificial" and I want to use said link:
localhost/my_projects/my_website
to get the contents of either of these links:
localhost/my_projects/my_website.php
localhost/my_projects/my_website.html
The reason for the two example files, instead of just one, is that I want to be able to switch between those two files when I edit the htaccess file. Obviously I only want to access one of those files at a time.
What do I need to have in my .htaccess file inside the my_projects folder to accomplish that? How can I make one specific link redirect to another specific link?
After reading your comment clarifying your folder structure I corrected the RewriteRule. (By the way, it would be best if you add that info to the question itself instead of in comments).
The url you want to target is: http://localhost/my_projects/my_website
http:// is the protocol
localhost is your domain (it could also be 127.0.0.1 or a domian name like www.example.com in the Internet)
I assume you are running Apache on port 80, otherwise in the url you need to also specify the port. For port 8086 for example it would be http://localhost:8086/my_projects/my_website.
The real path is htdocs/my_projects/my_website.php or htdocs/my_projects/my_website.html depending on your needs (obviously both won't work at the same time).
Here the my_projects in the "fake" url collides with the real folder "my_projects" so Apache will go for the folder and see there is no my_website (with no extension) document there (it won't reach the rewrite rules).
There is a question in SO that provides a work around for this, but it is not a perfect solution, it has edge cases where the url will still fail or make other urls fail. I had posted it yesterday, but I seem not to find it now.
The simple solution if you have the flexibility for doing it is to change the "fake" url for it not to collide with the real path.
One option is for example to replace the underscores with hyphens.
Then you would access the page as http://localhost/my-projects/my-website if you want to keep a sort of "fake" folder structure in the url. Otherwise you could simply use http://localhost/my-website.
Here are both alternatives:
# This is for the directory not to be shown. You can remove it if you don't mind that happening.
Options -Indexes
RewriteEngine On
#Rule for http://localhost/my-projects/my-website
RewriteRule ^my-projects/my-website(.+)?$ my_projects/my_website.php$1 [NC,L]
#Rule for http://localhost/my-website
RewriteRule ^my-website(.+)?$ my_projects/my_website.php$1 [NC,L]
(Don't use both, just choose one of these two, or use them to adapt it to your needs)
The first part the rewrite rule is the regular expression for your "fake" url, the second part is the relative path of your real folder structure upto the page you want to show.
In the regular expression we capture whatever what we assume to be possible query parameters after .../my_website, and paste it after my_website.php in the second part of the rule (the $1).
Later on if you want to point the url to my_website.html, you have to change the second part of the rule, where it says .php, replace it by .html.
By the way, it is perfectly valid and you'll see it in most SEO friendly web sites to write an url as http://www.somesite.com/some-page-locator, and have a rewrite rule that translates that url to a page on the website, which is what I had written in my first answer.
I'd like to create a rewrite in .htaccess for my site so that when a user asks for URL A, the content comes from URL B, but the user still sees the URL as being URL A.
So, for example, let's say I have content at mydomain.com/projects/project-example. I want users to be able to ask for mydomain.com/project-example, still see that URL in their address bar, but the browser should display the content from mydomain.com/projects/project-example.
I've looked through several .htaccess rewrite tips and FAQs, but unfortunately none of them seemed to present a solution for exactly what I've described above. Not everything on my domain will be coming from the /projects/ directory, so I'd imagine the rewrite should check to see if the page exists first so it's not appending /projects/ to every url. I'm really stumped.
If a rewrite is not exactly what I need, or if there is a simple solution for this problem, I'd love to hear it.
This tutorial should have everything that you need, including addressing exactly what you are asking: http://httpd.apache.org/docs/2.0/misc/rewriteguide.html . It may just be a matter of terminology.
So, for example, let's say I have content at mydomain.com/projects/project-example. I want users to be able to ask for mydomain.com/project-example, still see that URL in their address bar, but the browser should display the content from mydomain.com/projects/project-example.
With something like:
RewriteRule ^project-example$ /projects/project-example [L]
When someone requests http://mydomain.com/project-example and the URI /project-example gets rewritten internally to /projects/project-example. Note that when this is in an .htaccess file, the URI /project-example gets the leading slash removed when matching.
If you have a directory of stuff, you can use regular expressions and back-references, for example you want any request for http://mydomain.com/stuff/ to map to /internal/stuff/:
RewriteRule ^stuff/(.*)$ /internal/stuff/$1 [L]
So requests for http://mydomain.com/stuff/file1.html, http://mydomain.com/stuff/image1.png, etc. get rewritten to /internal/stuff/file1.html, /internal/stuff/image1.png, etc.
I have a website with multiple folders and I was trying to fix them in my .htaccess. After a little while, I have a big .htaccess with rules that conflicts.
Now every time I want to add a folder I have to add it to the .htaccess.
I did some research and I found out I can create symbolic link instead, so no more .htaccess
In both solution I have to create or modify something so for me its the same result at the end but is it a better practice to create instead symbolic link ?
Symbolic links are faster yes (like Aki said) but here's my thoughts on this.
if you have images, css or js files then you don't need to rewrite or create symbolic links. You can use the full URL (eg /images/...) or use a common domain like i.domain.com (or anything you want) and refer all your JS, Images and CSS there. Eg: i.domain.com/logo.jpg or js.domain.com/site.js.
This way, you never have to think about rewriting rules or create links you might forget one day.
This one is very easy to manage and maintain if you need to add images, change js or update your CSS since you only have one point of entry and automatically everything be updated.
use symblink, .htaccess has to be proccesed by apache whereas the symblink are proccess by the OS which is faster.
creating 100 rules vs 100 symblink, if the rule you looking for is at the last you will have to parse all of them then use the one you need.
thanks for your help; I'm new to all this URL mapping, however I believe this is a simple problem...
I'm migrating a ColdFusion application from GoDaddy (who recently dropped their ColdFusion support) to CFDynamics.
I have a URL for my new root: cfd123.cfdynamics.com/lbc this is my wwwroot directory where I've put the website. (It's actually: D:\Inetpub\wwwroot\lbc.com\wwwroot but I don't think that matters)
The problem is that all the HTML URIs: href and src attributes, etc. within the site were written using absolute paths: "/images/some.jpg", etc. and now I want them to map to "cfd123.cfdynamics.com/lbc/images/some.jpg".
I figure I need to map "/something" to "/lbc/something" everywhere it's referenced. This seems like it should be simple, just map a leading "/" to "/lbc/" and I'm good to go.
So, I went to create an "Alias / /lbc/" sort of listing and put it in my .htaccess file. Now I discover that Alias isn't allowed in .htaccess. (I think if I had access to httpd.conf I could use an Alias there, but it's a shared hosting environment and I don't have that access.)
So, I thought I'd try rewriting rules (still in the .htaccess file):
RewriteEngine on
RewriteBase /lbc
RewriteRule ^/(.*)$ /$1 [L,R=301]
To no avail. So, I'm not finding that any of the obvious things work (and I'm not even sure I've done them correctly). I don't see any debug mechanisms that are showing me anything (chrome just shows me the 404 errors one would expect when a file isn't found.)
And this is all new to me and starts getting pretty hairy pretty fast. Can anybody point me in the right direction?
Thanks, Steve
p.s. I can take care of the ColdFusion CFInclude directives by creating an Application.cfc file in the wwwroot directory containing the code below, but that doesn't do anything for the various HTML links throughout the page.
<cfset this.name = "AbsoluteReference"/>
<cfset this.mappings = structNew() />
<cfset this.mappings["/"] = getDirectoryFromPath(getCurrentTemplatePath())/>
Your running a windows server at CFDynamics I can tell from this
I have a URL for my new root: cfd123.cfdynamics.com/lbc this is my wwwroot directory where I've put the website. (It's actually: D:\Inetpub\wwwroot\lbc.com\wwwroot but I don't think that matters)
This is a windows structure "D:\Inetpub\wwwroot\lbc.com\wwwroot" so .htaccess will not work for URL rewrites, since your on a shared environment you will not be able to do what you need to. These changes would have to be made in IIS and that's not an option. If you have Dreamweaver you can do a mass find replace for /images/ and replace with /ibc/images/ and for link do href="/ replace with href="/ibc/.
Hope this helps.