Welcome to WebmasterWorld Guest from 54.197.171.28

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

how to remove folder name from url?

Client removed section name from cms now google links 404

   
11:21 pm on Feb 17, 2011 (gmt 0)

5+ Year Member



Joomla site client removed the virtual folder "general" from the urls.

I can't even figure how she did that but it wasn't through htaccess.

Google linked her urls with /general/ in the url. They're 404'ing.

How can I re-write her site's links so that if someone asks for

http://example.com/category/general/something.html

it goes to the correct place which is

http://example.com/category/something.html

I've looked and looked but can't find this exact answer.

Thank you!

[edited by: jdMorgan at 4:53 am (utc) on Feb 18, 2011]
[edit reason] Switched to example,.com to avoid auto-linking [/edit]

11:30 pm on Feb 17, 2011 (gmt 0)

5+ Year Member



those urls didn't print --

need

site / category / general / page

to be

site / category / page

thank you!
11:39 pm on Feb 17, 2011 (gmt 0)

WebmasterWorld Senior Member topr8 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



the reason those url's don't print is that you should use

example.com - that's what it is for.

... what have you tried so far?
12:53 pm on Mar 1, 2011 (gmt 0)

5+ Year Member



thank you so much, my apologies for the delay.

I've tried

1
RewriteRule ^/?general([a-z/.]*)$ /$1 [R=301,L]

2
RewriteCond $1 !^general/
RewriteCond ^/(.*)$ /general/$1 [L]

3
RewriteRule ^general/(.*)$ /$1 [L]


I'm pretty much a newb at htaccess.
2 is a server error
1 and 3 just don't work
1:53 pm on Mar 1, 2011 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



The redirects must be listed before the Joomla internal rewrite code.

The redirects must use RewriteRule syntax with the [R=301,L] flags.

RewriteRule ^(([^/]+/)*)general/([^.]+)\.html http://www.example.com/$1/$3.html [R=301,L]


Immediately after this code, place your canonical non-www to www redirects, again using RewriteRule syntax.

See also: [webmasterworld.com...]
4:14 am on Mar 3, 2011 (gmt 0)

5+ Year Member



Fantastic! Thank you so much!