trailing-slash

Handle trailing slash with Codeigniter 3

三世轮回 提交于 2021-01-29 03:44:51
问题 I have a database of articles with the urls as follow: person/albert-einstein/ (trailing slash) person/albert-einstein/1 (no trailing slash) And I was wondering what was the best way to handle url trailing slashes in Codeigniter 3? This is what I have done/test so far: echo site_url('person/albert-einstein/'); # http://localhost/person/albert-einstein echo base_url('person/albert-einstein/'); # http://localhost/person/albert-einstein echo site_url('person/albert-einstein/1'); # http:/

Retrofit trailing slash on relative urls

a 夏天 提交于 2020-07-19 06:14:38
问题 Does Retrofit remove the trailing slash from a relative url for an endpoint? I have tried adding the trailing slash on one of my endpoints but when i step through with a debugger and i look at the Call object, if I drill into the delete.relativeUrl it does not show the trailing slash. 回答1: You need to manually add the slash at the end of the base URL endpoint. Let's say you have this two instances of retrofit: No Slash Retrofit retrofitNoSlash = new Retrofit.Builder() .baseUrl("https:/

Retrofit trailing slash on relative urls

☆樱花仙子☆ 提交于 2020-07-19 06:13:22
问题 Does Retrofit remove the trailing slash from a relative url for an endpoint? I have tried adding the trailing slash on one of my endpoints but when i step through with a debugger and i look at the Call object, if I drill into the delete.relativeUrl it does not show the trailing slash. 回答1: You need to manually add the slash at the end of the base URL endpoint. Let's say you have this two instances of retrofit: No Slash Retrofit retrofitNoSlash = new Retrofit.Builder() .baseUrl("https:/

Apache's mod_rewrite failing to remove trailing slash

廉价感情. 提交于 2020-01-07 03:36:06
问题 I have a XAMPP Apache server, and have added a configuration file to rewrite URLs with a trailing slash and redirect to their slash-less counterparts. Therefore, a url like http://example.com/the-audio/ gets redirected to http://example.com/the-audio . The problem is, it's not working when the directory name is only one word. So, http://example.com/audio/ does not get it's slash removed. This is really strange for me, and checking the logs it appears as though the rule isn't matched in this

When should I use a trailing slash in my URL?

别等时光非礼了梦想. 提交于 2019-12-27 10:34:47
问题 When should a trailing slash be used in a URL? For example - should my URL look like /about-us/ or like /about-us ? I am fully aware of the SEO-related issues - duplicate content and the canonical thing; I'm trying to figure out which one I should use in the context of serving pages correctly alone. For example, my colleague is thinking that a trailing slash at the end means it's a "folder" - a "directory", so this is not a correct style. But I think that without a slash in the end - it's not

Remove trailing slash if not a directory with apache

血红的双手。 提交于 2019-12-23 09:37:40
问题 I have the following rewrite rules: #remove the www. RewriteCond %{HTTP_HOST} ^www.website.co.uk$ [NC] RewriteRule ^(.*)$ http://local.website.co.uk/$1 [R=301,L] #this removes php extention RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] # stops you accessing url with.php RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^.?\ ]+)\.php RewriteRule ^([^.]+)\.php(/.+)?$ /$1%{PATH_INFO} [R=301] I want to add in a rule that removes the trailing slash if someone tries to access site

Get request only works with trailing slash (spring REST annotations)

不羁岁月 提交于 2019-12-22 08:58:17
问题 I have a Spring REST Controller: @RestController @RequestMapping(value = "/myresource") public class MyResourceController { ... } With a GET request method: @RequestMapping(method = GET, value = "/{value1}/{value2}/{value3}", produces = MediaType.APPLICATION_JSON_VALUE + ";charset=UTF-8") public ResponseEntity<MyResponseType> getMyResource( @ApiParam(value = "...",...) @PathVariable("value1") String value1, @ApiParam(value = "...",...) @PathVariable("value2") String value2, @ApiParam(value =

Why does IIS 7.5 adds a trailing slash on folders? Can we disable courtesy redirect for a URL Rewrite rule that removes trailing slash?

旧巷老猫 提交于 2019-12-20 17:14:51
问题 IIS does URL cleanup on directories by adding a trailing slash. See this old docs from IIS 6: IIS generates courtesy redirect when folder without trailing slash is requested Why? Is the intent still relevant? Any security implications? How can I disable it to make this work with a URL Rewrite rule "RemoveTrailingSlashRule" When you add a rule under IIS 7.5 with URL Rewrite 2, the rule will not be applied to directories (using IsDirectory) and folders (using IsFolder). See this warning on Add

How to configure .htaccess file for rewrite rules to get rid of extensions, trailing slashes, www?

冷暖自知 提交于 2019-12-13 07:00:40
问题 This is what I want - When somebody enters site.com/page.php or site.com/page or site.com/page/ , all should work the same, and the url displayed in the address bar should be site.com/page [ I don't like extensions and trailing slashes ] I also want to get rid of the www from the url bar, as it's unnecessary. This is my current .htaccess files Rewrite rules - RewriteEngine on RewriteCond %{HTTP_HOST} ^site\.com RewriteRule ^(.*)$ http://www.site.com/$1 [R=permanent,L] RewriteEngine On