htaccess - URL 'folders' always show 'folders/?link=folders'
up vote
1
down vote
favorite
I'm sorry if my question is unclear. I rewrite rule url by htaccess and it worked. So i have a problem when i try to link path of the existing folder.
My problem:
Redirect url: 'http://localhost/folders'
But it display: 'http://localhost/folders/?link=folder'
So, I don't want it show '?link=folder'. It not show '?link=folder' with Redirect url: 'http://localhost/folders'
My htaccess:
RewriteEngine On
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteRule ^$ index.php [L]
RewriteRule ^([^/]*)/$ index.php?link=$1&%QUERY_STRING [L]
RewriteRule ^([^/]*)/([^/]*)/$ index.php?link=$1&action=$2&%QUERY_STRING [L]
RewriteRule ^([^/]*)/([0-9]+)/([^/]*)/$ index.php?link=$1&id=$2&action=$3&%QUERY_STRING [L]
RewriteRule ^([^/]*)$ index.php?link=$1&%QUERY_STRING [L]
RewriteRule ^([^/]*)/([^/]*)$ index.php?link=$1&action=$2&%QUERY_STRING [L]
RewriteRule ^([^/]*)/([0-9]+)/([^/]*)$ index.php?link=$1&id=$2&action=$3&%QUERY_STRING [L]
RewriteRule !^(public/*|folder/*|index.php) [NC,F]
Please, someone tell me how to fix. I'm sorry if my english is bad.
.htaccess
add a comment |
up vote
1
down vote
favorite
I'm sorry if my question is unclear. I rewrite rule url by htaccess and it worked. So i have a problem when i try to link path of the existing folder.
My problem:
Redirect url: 'http://localhost/folders'
But it display: 'http://localhost/folders/?link=folder'
So, I don't want it show '?link=folder'. It not show '?link=folder' with Redirect url: 'http://localhost/folders'
My htaccess:
RewriteEngine On
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteRule ^$ index.php [L]
RewriteRule ^([^/]*)/$ index.php?link=$1&%QUERY_STRING [L]
RewriteRule ^([^/]*)/([^/]*)/$ index.php?link=$1&action=$2&%QUERY_STRING [L]
RewriteRule ^([^/]*)/([0-9]+)/([^/]*)/$ index.php?link=$1&id=$2&action=$3&%QUERY_STRING [L]
RewriteRule ^([^/]*)$ index.php?link=$1&%QUERY_STRING [L]
RewriteRule ^([^/]*)/([^/]*)$ index.php?link=$1&action=$2&%QUERY_STRING [L]
RewriteRule ^([^/]*)/([0-9]+)/([^/]*)$ index.php?link=$1&id=$2&action=$3&%QUERY_STRING [L]
RewriteRule !^(public/*|folder/*|index.php) [NC,F]
Please, someone tell me how to fix. I'm sorry if my english is bad.
.htaccess
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm sorry if my question is unclear. I rewrite rule url by htaccess and it worked. So i have a problem when i try to link path of the existing folder.
My problem:
Redirect url: 'http://localhost/folders'
But it display: 'http://localhost/folders/?link=folder'
So, I don't want it show '?link=folder'. It not show '?link=folder' with Redirect url: 'http://localhost/folders'
My htaccess:
RewriteEngine On
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteRule ^$ index.php [L]
RewriteRule ^([^/]*)/$ index.php?link=$1&%QUERY_STRING [L]
RewriteRule ^([^/]*)/([^/]*)/$ index.php?link=$1&action=$2&%QUERY_STRING [L]
RewriteRule ^([^/]*)/([0-9]+)/([^/]*)/$ index.php?link=$1&id=$2&action=$3&%QUERY_STRING [L]
RewriteRule ^([^/]*)$ index.php?link=$1&%QUERY_STRING [L]
RewriteRule ^([^/]*)/([^/]*)$ index.php?link=$1&action=$2&%QUERY_STRING [L]
RewriteRule ^([^/]*)/([0-9]+)/([^/]*)$ index.php?link=$1&id=$2&action=$3&%QUERY_STRING [L]
RewriteRule !^(public/*|folder/*|index.php) [NC,F]
Please, someone tell me how to fix. I'm sorry if my english is bad.
.htaccess
I'm sorry if my question is unclear. I rewrite rule url by htaccess and it worked. So i have a problem when i try to link path of the existing folder.
My problem:
Redirect url: 'http://localhost/folders'
But it display: 'http://localhost/folders/?link=folder'
So, I don't want it show '?link=folder'. It not show '?link=folder' with Redirect url: 'http://localhost/folders'
My htaccess:
RewriteEngine On
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteRule ^$ index.php [L]
RewriteRule ^([^/]*)/$ index.php?link=$1&%QUERY_STRING [L]
RewriteRule ^([^/]*)/([^/]*)/$ index.php?link=$1&action=$2&%QUERY_STRING [L]
RewriteRule ^([^/]*)/([0-9]+)/([^/]*)/$ index.php?link=$1&id=$2&action=$3&%QUERY_STRING [L]
RewriteRule ^([^/]*)$ index.php?link=$1&%QUERY_STRING [L]
RewriteRule ^([^/]*)/([^/]*)$ index.php?link=$1&action=$2&%QUERY_STRING [L]
RewriteRule ^([^/]*)/([0-9]+)/([^/]*)$ index.php?link=$1&id=$2&action=$3&%QUERY_STRING [L]
RewriteRule !^(public/*|folder/*|index.php) [NC,F]
Please, someone tell me how to fix. I'm sorry if my english is bad.
.htaccess
.htaccess
asked Nov 8 at 16:10
Newbie
62
62
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Your problem maybe to do with the DirectorySlash
. If "folders" is a physical directory on the filesystem and you request http://localhost/folders
(no trailing slash) then mod_dir "fixes" the URL by 301 redirecting to http://localhost/folders/
(with a trailing slash).
This mod_dir behaviour conflicts with the following rule that appends the ?link=folders
quesy string.
RewriteRule ^([^/]*)$ index.php?link=$1&%QUERY_STRING [L]
This "rewrite" will be turned into an external "redirect" by mod_dir.
You can try preventing mod_dir from appending the trailing slash on directories with the following directive at the top of your .htaccess
file:
DirectorySlash Off
However, you now need to manage all the trailing slashes yourself, which may not be trivial.
However, instead of the above, I would simply include a trailing slash on the URL to begin with and only match URLs that have the trailing slash, rather than both (you are duplicating your directives).
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Your problem maybe to do with the DirectorySlash
. If "folders" is a physical directory on the filesystem and you request http://localhost/folders
(no trailing slash) then mod_dir "fixes" the URL by 301 redirecting to http://localhost/folders/
(with a trailing slash).
This mod_dir behaviour conflicts with the following rule that appends the ?link=folders
quesy string.
RewriteRule ^([^/]*)$ index.php?link=$1&%QUERY_STRING [L]
This "rewrite" will be turned into an external "redirect" by mod_dir.
You can try preventing mod_dir from appending the trailing slash on directories with the following directive at the top of your .htaccess
file:
DirectorySlash Off
However, you now need to manage all the trailing slashes yourself, which may not be trivial.
However, instead of the above, I would simply include a trailing slash on the URL to begin with and only match URLs that have the trailing slash, rather than both (you are duplicating your directives).
add a comment |
up vote
0
down vote
Your problem maybe to do with the DirectorySlash
. If "folders" is a physical directory on the filesystem and you request http://localhost/folders
(no trailing slash) then mod_dir "fixes" the URL by 301 redirecting to http://localhost/folders/
(with a trailing slash).
This mod_dir behaviour conflicts with the following rule that appends the ?link=folders
quesy string.
RewriteRule ^([^/]*)$ index.php?link=$1&%QUERY_STRING [L]
This "rewrite" will be turned into an external "redirect" by mod_dir.
You can try preventing mod_dir from appending the trailing slash on directories with the following directive at the top of your .htaccess
file:
DirectorySlash Off
However, you now need to manage all the trailing slashes yourself, which may not be trivial.
However, instead of the above, I would simply include a trailing slash on the URL to begin with and only match URLs that have the trailing slash, rather than both (you are duplicating your directives).
add a comment |
up vote
0
down vote
up vote
0
down vote
Your problem maybe to do with the DirectorySlash
. If "folders" is a physical directory on the filesystem and you request http://localhost/folders
(no trailing slash) then mod_dir "fixes" the URL by 301 redirecting to http://localhost/folders/
(with a trailing slash).
This mod_dir behaviour conflicts with the following rule that appends the ?link=folders
quesy string.
RewriteRule ^([^/]*)$ index.php?link=$1&%QUERY_STRING [L]
This "rewrite" will be turned into an external "redirect" by mod_dir.
You can try preventing mod_dir from appending the trailing slash on directories with the following directive at the top of your .htaccess
file:
DirectorySlash Off
However, you now need to manage all the trailing slashes yourself, which may not be trivial.
However, instead of the above, I would simply include a trailing slash on the URL to begin with and only match URLs that have the trailing slash, rather than both (you are duplicating your directives).
Your problem maybe to do with the DirectorySlash
. If "folders" is a physical directory on the filesystem and you request http://localhost/folders
(no trailing slash) then mod_dir "fixes" the URL by 301 redirecting to http://localhost/folders/
(with a trailing slash).
This mod_dir behaviour conflicts with the following rule that appends the ?link=folders
quesy string.
RewriteRule ^([^/]*)$ index.php?link=$1&%QUERY_STRING [L]
This "rewrite" will be turned into an external "redirect" by mod_dir.
You can try preventing mod_dir from appending the trailing slash on directories with the following directive at the top of your .htaccess
file:
DirectorySlash Off
However, you now need to manage all the trailing slashes yourself, which may not be trivial.
However, instead of the above, I would simply include a trailing slash on the URL to begin with and only match URLs that have the trailing slash, rather than both (you are duplicating your directives).
answered Nov 8 at 18:36
MrWhite
11.9k33059
11.9k33059
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53211722%2fhtaccess-url-folders-always-show-folders-link-folders%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown