правило htaccess передать/login/и / входит в ту же страницу?

Я не использую его сам, но один из моих коллег использует этот стиль:

var myArray = [1,2,3,4];
for (var i = 0, item; item = myArray[i]; ++i) {
    alert(item);
}

как ответ Ash, это поразит проблемы, если у Вас будут значения "falsey" в Вашем массиве. Избегать, чтобы проблема изменила его на (item = myArray[i]) != undefined

6
задан Prashant 9 July 2009 в 20:21
поделиться

4 ответа

Just make the trailing slash optional:

RewriteRule ^videos/login/?$ /videos/login.php

But you should better use just one variant (with or without trailing slash) and redirect one to the other:

# add trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .*[^/]$ /$0/ [L,R=301]

# remove trailing slash
RewriteRule (.*)/$ /$1 [L,R=301]
13
ответ дан 8 December 2019 в 14:45
поделиться

Использование mod_rewrite

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/videos/login/?$
RewriteRule (.*) /videos/login.php [L,R=301]
1
ответ дан 8 December 2019 в 14:45
поделиться

This work fine for me:

Rewriterule ^login(/|)$ /videos/login.php

2
ответ дан 8 December 2019 в 14:45
поделиться
redirect 301 /videos/login/index.html http://yoursite.com/videos/login.php

The server will change the address http://mysite.com/videos/login/ and http://mysite.com/videos/login both to http://mysite.com/videos/login/index.html, based on the configuration but this is default. Before it encounters a 404 this address is redirected to the new one. At least this works at my site.

Had to use pre because the site let's me post only one hyperlink :/

0
ответ дан 8 December 2019 в 14:45
поделиться
Другие вопросы по тегам:

Похожие вопросы: