Page 1 of 1
[SOLVED] About "/" at end of url from Nibbleblog
Posted: Tue Jun 21, 2016 10:00 pm
by fdans
Hi friends,
I have migrated a blog from nibbleblog to bludit.
At Nibble, all url's ended with /
I have an issue with that concerning to tags url's.
in Nibble
http://www.mysite.com/tag/tag1/
at bludit
http://www.mysite.com/tag/tag1
because so much tags in the blog i tried to redirect with 301 in htaccess file, BUT...
the code to expect to works fine, does not function at all
this is the code :
Code: Select all
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
That i want to achieve is to redirect all url with site/tag/nameofthetag/ to site/tag/nameofthetag
that's erasing the last slash "/"
Does anybody else have a working solution for this problem?
The mine does not work
Many thanks for any help coming
Best regards from spain
paco
Re: About "/" at end of url from Nibbleblog
Posted: Tue Jun 21, 2016 11:39 pm
by Edi
1) As I understand you have migrated from Nibbleblog to Bludit. What should now be redirected? Can you show an example?
2) Perhaps this helps:
http://stackoverflow.com/questions/2141 ... h-from-url
Re: About "/" at end of url from Nibbleblog
Posted: Wed Jun 22, 2016 12:17 pm
by fdans
Thanks Edi for response.
The meanning is easy :
Google has indexed for example :
mysite/tag/nameofthetag/ url
now only exists at bludit , mysite/tag/nameofthetag url without the "/" at the end
then when a visitor goes to the first url indexed by google it receives "page dont exist" by the side of bludit, beacuse at mydomain in bludit ending on "/" gives 404-error , and then google has info that page dont exists, and user cant see my page.
ok?
also i have yet redirected via htaccess (one by one) all /category/nameofthecategory pages one by one, because were a few , but i have so much tags defined at my old nibbleblog... hard work and better to redirect all ending /tag/nameofthe tag/ to the same without "/"
Do you understand the reason i have to need redirection ?
Many thanks, Edi for all
Best regards
Paco
Re: About "/" at end of url from Nibbleblog
Posted: Wed Jun 22, 2016 8:26 pm
by Edi
The following from Stack Overflow works for me:
Code: Select all
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]
Added to .htaccess:
Code: Select all
AddDefaultCharset UTF-8
<IfModule mod_rewrite.c>
# Enable rewrite rules
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]
# Deny direct access to .txt files
RewriteRule ^bl-content/(.*)\.txt$ - [R=404,L]
# All URL process by index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) index.php [PT,L]
</IfModule>
Re: About "/" at end of url from Nibbleblog
Posted: Thu Jun 23, 2016 1:40 am
by fdans
Many thanks Edi, but
don't works for me...
I dont know if problem with apache or what
paco
Re: About "/" at end of url from Nibbleblog
Posted: Thu Jun 23, 2016 1:54 am
by Edi
1) Is mod_rewrite enabled?
2) Are the rules set in the right order?
Re: About "/" at end of url from Nibbleblog
Posted: Fri Jun 24, 2016 6:22 pm
by fdans
Hi Edi, finally solved!!!
Was a matter of order like you said
Also combined with this code :
Code: Select all
RedirectMatch 301 /tag/(.*)/ http://www.mysite.com/tag/$1
RedirectMatch 301 /page/(.*)/ http://www.mysite.com/$1
This eliminates de ending "/" for all url of a directory like tag or page ...
Many thanks for helping , my friend
beste regards
Paco