/    Sign up×
Community /Pin to ProfileBookmark

.htaccess file to remove everything but domain name from displaying

Hi,

I am trying to write an htaccess file so that if i type in:

[url]http://mydomain.com/somestring[/url]

It will display in the url bar:

[url]http://mydomain.com/[/url]

Is this possible? I’m finding it hard to find an answer to this on other forums.

Thanks in advance.

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@mikeroqApr 22.2011 — I don't know why you would want to hide the URL, but you can make your main page a giant frame and load all your pages into it.

You cannot only have mydomain.com and still be able to access mydomain.com/somestring
Copy linkTweet thisAlerts:
@DasherApr 22.2011 — In your main page you can load sub-pages, The outside world will only see mydomain.com

[code=php]
include ('mydomain.com/something/index.php');
[/code]
Copy linkTweet thisAlerts:
@mikeroqApr 23.2011 — The problem with that is you cannot link to pages. When you enter mysite.com/something your address bar will reflect that, if you only want to show mysite.com you cannot have any links pointing to mysite.com/something.
Copy linkTweet thisAlerts:
@vinoth_tApr 23.2011 — Just add the below line of code in .htaccess file
<i>
</i>RewriteEngine on
RewriteRule ^somestring ./ [L,R]
×

Success!

Help @coldscooter spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.12,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...