Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    95
    Thanks
    8
    Thanked 0 Times in 0 Posts

    mod_rewrite and .htaccess

    I have found loads of links and sample codes on this topic, but nothing to do what I want. I just want to show my base domain name regardless of what page is being looked at. I have a .htaccess file with this in it:-
    Code:
    Options +FollowSymlinks
    RewriteEngine on
    RewriteCond %{THE_REQUEST} ^.*/*.html
    RewriteRule ^(.*)*.html$ http://www.mydomain.net/$1 [R=301,L]
    This just chops the .html of the file name. Can anyone help me hide the whole file name and just show the domain name?

  • #2
    Senior Coder
    Join Date
    Jul 2005
    Location
    UK
    Posts
    1,051
    Thanks
    6
    Thanked 13 Times in 13 Posts
    Purely out of curiosity, why do you want to do this?

  • #3
    New Coder
    Join Date
    Mar 2004
    Posts
    95
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Pennimus View Post
    Purely out of curiosity, why do you want to do this?
    Eventually I am going to use dynamic pages with variables passed to the server in the url. I want to hide them. I like the idea of just showing the domain name in the url.

  • #4
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    Quote Originally Posted by Taipan View Post
    This just chops the .html of the file name. Can anyone help me hide the whole file name and just show the domain name?
    how will ur webserver figure out which page to serve next then?

    tis sad that someone still wants to show only their domain name in the addressbar...anyway the only way to do it is to use frames/iframes or use flash
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow

  • #5
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    I think you could also use Domain Masking, which would make your domain mask the actual location of your pages with just the simple domain name the entire visit.

  • #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,853
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Quote Originally Posted by jeremywilken View Post
    I think you could also use Domain Masking, which would make your domain mask the actual location of your pages with just the simple domain name the entire visit.
    How can we effectively do that?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #7
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Obviously the page can still be found if one knows the correct address, but it was an idea. I think it would do what the OP wanted for the most part. One would have to set it up with a domain registrar to do it. Not really recommended, but thought I'd throw it out there. If its a bad idea to do, I'd love to know that since I've never heard any the +/- of it.

  • #8
    Senior Coder
    Join Date
    Jul 2005
    Location
    UK
    Posts
    1,051
    Thanks
    6
    Thanked 13 Times in 13 Posts
    It's a terrible idea, really. Sit and think about the implications of only having one URL for a second:

    • Impossible to bookmark, link to or otherwise refer to any page other than the homepage.
    • Impossible for search engines to index anything other than your homepage.
    • Impossible for users to use the URL as a cue to where they are in the site.


    Ways to do it:

    • Contain all content hidden in layers on one page, and use JavaScript to swap which layer is visible.
    • Use AJAX to dynamically swap content on the page.
    • Use frames.
    • Use flash.


    Taipan - if you think variables are ugly the answer is not to try and hide them! Either change them so they aren't ugly, or use mod_rewrite to change them into a conventional domain/directory/file structure.
    Last edited by Pennimus; 04-25-2008 at 02:47 PM.

  • #9
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Quote Originally Posted by Pennimus View Post
    It's a terrible idea, really. Sit and think about the implications of only having one URL for a second:

    • Impossible to bookmark, link to or otherwise refer to any page other than the homepage.
    • Impossible for search engines to index anything other than your homepage.
    • Impossible for users to use the URL as a cue to where they are in the site.


    Ways to do it:

    • Contain all content hidden in layers on one page, and use JavaScript to swap which layer is visible.
    • Use AJAX to dynamically swap content on the page.
    • Use frames.
    • Use flash.

    This is just a question, but don't your suggestions have some of the issues as masking the domain?

    Obviously with masking, bookmarks are restricted only to the homepage, but with Flash, Frames, Ajax, hidden layers, these are all restricted to bookmarking the page in which they are placed, not necessarily allowing for easy cueing. A good design would minimize that, but its still an issue.
    Search engines still index the site, and in fact they index it with the correct URL. The mask isn't detected. Its because a mask doesn't replace the actual URL. So if my homepage links to mydomain.com/page2.html that is still the link when it is indexed by a search engine. In which case the domain mask is lost when indexed. You could get around this by checking the URL for the mydomain.com and redirect to mymask.com, but this is all silly. Masking is merely a forwarding address which persists during the visit. Unless a visitor enters from that address, the mask is not applied.

    I agree that I would rather use any of your items, but they don't solve all of the issues present either. I guess I don't know if there is a solution exactly to this question.
    Last edited by gnomeontherun; 04-25-2008 at 03:29 PM.

  • #10
    New Coder
    Join Date
    Mar 2004
    Posts
    95
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by shyam View Post
    how will ur webserver figure out which page to serve next then?

    tis sad that someone still wants to show only their domain name in the addressbar...anyway the only way to do it is to use frames/iframes or use flash
    I am not really sure how the mod_rewrite works. The code I posted still serves the correct webpage, but doesn't display the .html part. I just wanted to know a way to not display the page name either.

    I don't understand why you would think this is sad, and why 'still'. If other people have wanted to do it then they have a reason too. I have been to a site recently that only shows the domain name regardless of which page I looked at. I want to do the same with my site. I am not trying to do anything malicious.

  • #11
    New Coder
    Join Date
    Mar 2004
    Posts
    95
    Thanks
    8
    Thanked 0 Times in 0 Posts
    It is no real big deal if I can't, but the bookmarking, indexing etc, really doesn't matter to me. The site is a very simple site and is going to have 4 pages. It is not designed to be an overly public site, it is going to document a project I am doing and I will probably only link people to it that express interest.

    I'll probably just use Pennimus suggestion and "use mod_rewrite to change them into a conventional domain/directory/file structure."

  • #12
    Senior Coder
    Join Date
    Jul 2005
    Location
    UK
    Posts
    1,051
    Thanks
    6
    Thanked 13 Times in 13 Posts
    This is just a question, but don't your suggestions have some of the issues as masking the domain?
    Yes they all do. I wasn't suggesting they didn't However I wanted to list some more options for the OP in case he wanted to go ahead with it (which I'm happy to see he isn't going to).

  • #13
    New Coder
    Join Date
    Apr 2008
    Location
    Kansas City, KS
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I would also think you run the risk of getting the search engines perturbed with you. I could see them possibly accusing you of cloaking. May not be worth it


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •