New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
HTACCESS - Page redirection
I am using the current version of wordpress.
The below is what I am trying to achieve.
Scenario 1
User types example.com/x in the addressbar
User gets content from example.com/x
Scenario 2
1.User goes to site...
Clicks on the link in the menu linking example.com/x
User gets content from page example.com/y while at the sametime the addressbar shows example.com/x
If someone could guide me or give me the solution to achieve this through .htaccess, it would be a great help.
Thanks
Comments
That can be easily done with domain masking I Assume.
But wouldn't that by default show the alternate content always. What I would like to achieve is that the alternate content is only displayed while going through the menu (or links within the site) and not while accessing directly through the url
or in reverse (i.e the alternate content is displayed only while accessing the page through typing the address in the addressbar or through an external link)
you probably want to take a look into the use of
to be able to decide if someone has been send from another page or typed that url. as referers are optional behaviour there is no guarantee that this will always work, so don't use it in a way where displaying the content at all relies on that function.
but I think your use case is very rare. why would someone type a complicated url manually and how should he even obtained these url while he normally isn't able to see it through the normal masked interface in first place?
The typing in the addressbar is just a case. It could be anything apart from clicking on the actual menu link
Look into hotlink protection, sounds like the same thing as what you want to achieve.
ok, so only if the referer matches your own domain links should work as expected, otherwise you would want the user to be redirected to the main-site...
best is to look into the wp-mu tutorial, on website redirection using htaccess
To be precise...
Referrer matches my site domain.com i.e user clicks on the link to the page from within the site
domain.com/test (url in addressbar) = domain.com/subfolder/test (page content)
If Referrer does not match my site domain.com i.e user comes to page from external url or by typing the url in the addressbar
domain.com/test (url in addressbar) = domain.com/test (page content)
There is also an additional requirement that when inside domain.com/test when the user has come from an external link or by manually tying url in addressbar, clicking on link to domain/test should display content from domain/test. There are 6 such links/routes that need to function this way
then you might want to use something like this:
https://httpd.apache.org/docs/2.4/rewrite/access.html#referer-deflector
to define your 6 links, based on your own domain as referer ;-)
Thanks. Will look into it.