homepage Welcome to WebmasterWorld Guest from 54.166.122.65
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
how to remove folder name from url?
Client removed section name from cms now google links 404
digiweb

5+ Year Member



 
Msg#: 4268733 posted 11:21 pm on Feb 17, 2011 (gmt 0)

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]

 

digiweb

5+ Year Member



 
Msg#: 4268733 posted 11:30 pm on Feb 17, 2011 (gmt 0)

those urls didn't print --

need

site / category / general / page

to be

site / category / page

thank you!

topr8

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



 
Msg#: 4268733 posted 11:39 pm on Feb 17, 2011 (gmt 0)

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?

digiweb

5+ Year Member



 
Msg#: 4268733 posted 12:53 pm on Mar 1, 2011 (gmt 0)

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

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4268733 posted 1:53 pm on Mar 1, 2011 (gmt 0)

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...]

digiweb

5+ Year Member



 
Msg#: 4268733 posted 4:14 am on Mar 3, 2011 (gmt 0)

Fantastic! Thank you so much!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved