[SOLVED] About "/" at end of url from Nibbleblog

Post Reply
fdans
Sr. Bludit
Posts: 38
Joined: Wed Jun 10, 2015 9:14 pm

Tue Jun 21, 2016 10:00 pm

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
Last edited by fdans on Fri Jun 24, 2016 7:03 pm, edited 1 time in total.
User avatar
Edi
Site Admin
Posts: 1651
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Tue Jun 21, 2016 11:39 pm

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
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
fdans
Sr. Bludit
Posts: 38
Joined: Wed Jun 10, 2015 9:14 pm

Wed Jun 22, 2016 12:17 pm

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
User avatar
Edi
Site Admin
Posts: 1651
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Wed Jun 22, 2016 8:26 pm

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>
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
fdans
Sr. Bludit
Posts: 38
Joined: Wed Jun 10, 2015 9:14 pm

Thu Jun 23, 2016 1:40 am

Many thanks Edi, but
:( don't works for me...
I dont know if problem with apache or what

paco
User avatar
Edi
Site Admin
Posts: 1651
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Thu Jun 23, 2016 1:54 am

1) Is mod_rewrite enabled?

2) Are the rules set in the right order?
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
fdans
Sr. Bludit
Posts: 38
Joined: Wed Jun 10, 2015 9:14 pm

Fri Jun 24, 2016 6:22 pm

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
Post Reply