homepage Welcome to WebmasterWorld Guest from 54.211.97.242
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

    
redirect everything to homepage
unclej



 
Msg#: 4671338 posted 6:38 pm on May 15, 2014 (gmt 0)

I want to redirect every inner page to homepage
example.com/ksfuhisfgd
example.com/sfjiest.html
example.com/usdf?sdfuis=sfhsdf

these should all be 301 redirected to homepage

This is the code I have found:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . / [L,R=301]

It works on the first 2, but not the third one. If a url has any weird symbols, like ? or = then it doesn't work. I guess it kind of works. I will describe how it behaves
so for example, for example.com/usdf?sdfuis=sfhsdf
I see the homepage, but in the address bar, it still says example.com/usdf?sdfuis=sfhsdf

How can I fix this?

 

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4671338 posted 8:30 pm on May 15, 2014 (gmt 0)

I hope you appreciate that everyone seeing the subject line immediately said Noooo!

example.com/usdf?sdfuis=sfhsdf

Is that your actual URL? Extensionless, but with a query string? Why?

for example.com/usdf?sdfuis=sfhsdf
I see the homepage, but in the address bar, it still says example.com/usdf?sdfuis=sfhsdf

Danger. Crystal ball says you're using a CMS which is already rewriting all requests to the homepage. Rewriting, not redirecting; that's why the URL doesn't change.

unclej



 
Msg#: 4671338 posted 2:25 am on May 16, 2014 (gmt 0)

actually, i am not using a cms
here is the story. I just bought a domain and checked the previous site's top pages. I want to redirect its top pages to the homepage and the top pages happen to have the structures that I mentioned.

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4671338 posted 6:08 am on May 16, 2014 (gmt 0)

Whoops, I've just given you the identical answer in two different threads because I didn't recognize the name first time around.

But the main issue remains:
I see the homepage, but in the address bar, it still says example.com/usdf?sdfuis=sfhsdf

This is impossible unless there is already a rewrite in place. You need to find it.

not2easy

WebmasterWorld Administrator 5+ Year Member Top Contributors Of The Month



 
Msg#: 4671338 posted 1:17 pm on May 16, 2014 (gmt 0)

Because of this issue:
But the main issue remains:
I see the homepage, but in the address bar, it still says example.com/usdf?sdfuis=sfhsdf

This is impossible unless there is already a rewrite in place. You need to find it.
it looks like a plugin is currently involved in rewriting URLs.

To understand what you want to do, this used to be a wordpress site, but you plan to do something different with it, correct? It normally is not a good practice telling your site to show page-A when page-B is requested. If the content of page-B is gone, the page is expected to return a 404 response. If page-B is gone, but the contents of page-B is now on page-A, then you can redirect people to page-A. Please help if this is not the case.

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