[web] redirecting and hiding the URL

This topic is 3068 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I want to mask the actual URL at what my page is (domain.com&arglistblah) and substitute it with something more sensible (eg domain.com/friends). The only way of accomplishing this (edit: that I can think of, that is :D) is by creating a redirect page. By using a simple php redirect script I can get things working and they look nice, but the browser still displays the ugly URL in the address bar. By using IFRAMEs/FRAMEs I can avoid that, but that generates a white border around the frame and the frame flashes white when loading from a non-framed page. Right now this seems like a dead end either way to me. Can anyone suggest something else I could try that would mask the url AND get rid of the flash? [Edited by - irreversible on February 26, 2010 8:42:45 AM]

Share on other sites
HTML includes?
Maybe something like display:hidden; in your stylesheet and when the link is pressed un-hide the hidden section?
Hard to know what you're talking about though...

Share on other sites
Use URL rewriting on the server.

Share on other sites
Sorry, I'm a bit daft when it comes to web stuff (only reason I'm messing with this is that it's my personal website), but here's a more detailed description:

I'm using Wordpress and WP generates URLs in the format "http://www.domain.com&page_id=30". However, I want the address bar to display "http://www.domain.com/stuff" instead while the contents of the page that is displayed is still from WP's page_id=30.

I'm not sure URL rewriting would help me (becuase I'm concerned with the name in the address bar) and additionally I'm purchasing webspace and I'm not quite sure how to go about using/setting up URL rewriting from a consumer's standpoint.

Using IFRAMEs takes care of this -

index.html in subfolder "stuff":
<iframe src ="http://www.domain.com&page_id=30" width="100%" height="300">  Your browser does not support iframes.</iframe>

However, it also produces a white border around the frame (visible client area), at least in Firefox, and when loading index.html, the frame's content is erased (filled with white), causing the broweser to flash white for a brief moment before the frame is displayed.

Using PHP redirection avoids the flash, but doesn't provide a workawround for the displayed URL in the address bar:

index.html:
<?php header( 'Location: http://www.domain.com&page_id=30' ); ?>

Share on other sites
Quote:
 Original post by irreversibleI'm not sure URL rewriting would help me (becuase I'm concerned with the name in the address bar)

That's what URL rewriting is for.
Quote:
 and additionally I'm purchasing webspace and I'm not quite sure how to go about using/setting up URL rewriting from a consumer's standpoint.

Share on other sites
Just to confirm what Sneftel is saying, you're after URL rewriting.

Quote:

Using mod_rewrite or lighttpd you can produce much nicer permalinks (see Pretty Permalinks). There are many different formats, but the most common, and most versatile looks like
Quote:
 http://example.com/category/post-name/or http://example.com/year/month/day/post-name

Some people eliminate some or all of the date elements (day, month, year) to have a shorter permalink format.

• Apache web server with the mod_rewrite module

• Microsoft IIS 7+ web server with the URL Rewrite 1.1+ module and PHP 5 running as FastCGI

• Microsoft IIS 6+ using ASAPI_Rewrite or a 404 handler or Mod-Rewrite Pro

• Lighttpd using a 404 handler or mod_rewrite or mod_magnet (see External sources)
The links on that page should give you more information to get started. You'll need to talk to your hosting provider if the required options aren't provided by default.

Share on other sites
Or as you seem to be passing info you could use forms instead....

<form>
<input type="hidden" name="blah" value="blahvalue">

Share on other sites
I'll ask my host about URL rewriting - thanks for the feedback, guys!

Share on other sites
Alrighty - I got almost everything up and running. At least WordPress is using custom permalinks via URL rewriting now so it seems to be working.

Last thing I'm having some trouble with (and I know this should probably rather go in the WP support forum) are static links to WP pages that I've manually placed in my theme source code:

if I use the WP default indexed format (&page_id=X) the links work but don't get rewritten (eg I can still see the ugly format in the address bar when navigating from my static links). I understand I need to add something extra to .htaccess, but I'm not sure what it is. Current file contents, as provided by WP:

<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule>

Or, once again, I could be daft enough to be missing something obvious, so don't be shy to point it out :)

Share on other sites
Seems I was sounding the alarm too early - page needs to be published for URL rewriting to work in WP. I'm not really sure I care why - in any case, private publishing is handling it nicely :)

1. 1
2. 2
3. 3
Rutin
17
4. 4
5. 5

• 10
• 14
• 30
• 13
• 11
• Forum Statistics

• Total Topics
631787
• Total Posts
3002354
×