I got a website made in Wordpress, and it's not finished yet but I want people to be able to only visit a certain link.
Let say my website is: www.mywebsite.com, and the only section finished is www.mywebsite.com/gallery.
Inside the gallery I have several links, that should work. (those links open new pages).
However, if people go to www.mywebsite.com, it should redirect them to www.mywebsite.com/gallery.
I've seen several different redirect plugins, but I'm unsure what would be the best choice.
I want something simple that just works.
HTML meta-tag:
<meta http-equiv="refresh" content="1; URL=http://www.foobar.com/gallery">
PHP header function:
header("location: /path/to/folder");
JavaScript:
window.location.href = "http://www.foobar.com/gallery";
I suggest you to put a file (index.php) into your root folder and write the following in it:
<?php
header("location: gallery/index.php");
?>
But if you have no PHP on your Server you can also use the method with HTML or JavaScript as well.
I hope this helps :-)
Since mwatzer answer seems correct to any website, I would strongly suggest to use a plugin or change your start page by setting your gallery page as home page, WordPress automatically removes scripts inside pages and entries, and if you change your template files, on the next template update they will be gone unless you create a child theme.
Check WordPress Codex here: WordPress changing home page
Or check this plugin: Quick Page/Post Redirect Plugin
Related
How can I do block a site page from the outside? I don't want anyone accessing a the page without going through another one first. For example, I don't someone to just be able to type www.example.com/test without first being on www.example.com and then pressing a link I have pasted on the www.example.com. I have seen another question similar, but I don't know anything about coding so the answers are confusing for me. Could someone direct me in the way to do? This was the post I saw, but I don't understand the answers: Prevent direct access to a webpage by typing the URL. I don't want anyone, even logged in users to be able to access these pages, at least not until they have paid, but that is another story. However, if you could help me with that, that would be great.
Unfortunately I don't think WordPress has a plugin for this so you'll have to get into the code. I also don't know what language WordPress uses but if your file extensions are .html, .htm, or .php then you're in business. There are a few ways you can do this but I'm going to give you the way that should be compatible with all browsers.
So on your referrer page (in your case example.com) you're going to insert the following code between <head> and </head>:
<script>
function redirect(){
document.getElementById('redirect').submit();
}
</script>
Then, on the same page between <body> and </body> insert:
<form id='redirect' action='/yourPage' method='POST'>
<input type='hidden' name='redirected', value='true' hidden>
</form>
Make sure to change yourPage to the correct page. Next, on the same page between <body> and </body> find something that looks like:
<a href='/yourPage'>What ever your link says</a>
And change it to:
<a href='javascript:redirect()'>What ever you want your link to say</a>
Lastly, go to the page you want protected (you wrote it as test, it's yourPage in my code) and first, make sure the if the extension is .html or .htm, change it to .php, then insert the following at the very top:
<?php
if(!isset($_SERVER['POST']['redirected'])){
header('Location:www.example.com');
die();
}
?>
Make sure to change www.example.com to your website. You may also wonder what the 'die()' does. The 'header' part is a redirect REQUEST and will all requests, the client can say no. So die basically says if you don't redirect, you still can't see the web page.
Hopefully this helps, if your page is not .htm, .html, or .php please comment what the extension is so I can find an equivalent in that language.
Gday
I like to know how you would go about creating a home page in plain html and have WordPress run the other pages?
The reason is I’d like to create a solely plain html website but I need WordPress for my contact page it has a large form on it and I use a plugin to generate it and forms are a bit beyond my knowledge at the moment to create a contact page myself.
(I have tried creating a template page but then WordPress adds unnecessary code [from plugins ] and makes the AMP invalid)
Honestly I'd try and keep it self contained in WordPress itself.
If for some reason you really want a separate HTML/PHP Homepage, follow these steps:
Add a my-homepage.php file to your /wp-content/themes/ACTIVE-THEME directory
Inside that file put the following code:
Add a new page (Pages > Add New)
Give it a recognizable name like "My Homepage"
In the "Template" selector on the right hand side, pick "My HTML Homepage" and click Publish
Go to Settings > Reading, change Your homepage displays to A static page and pick the page you just made
Now you can add your own code as you see fit. Nothing "WordPress" related will get loaded or hooked in since there's no functions on that file - so you're free to code HTML (or PHP) to your heart's content.
You can see a bit more indepth answer over on WPSE: https://wordpress.stackexchange.com/questions/296592/how-to-use-custom-html-file-instead-of-wordpress-homepage
My site uses both PHP and the JS AJAX so I'm fairly familiar with them both, and I don't want a solution that includes them. I have this page structure where all my users stay on just one landing php page, which then fetches the right content depending on the URL's p variable.
http://www.example.com/?p=about
http://www.example.com/?p=aMap-anothermap-evenAnothermap-lastelyTheFile
This page structure works great for me except that I don't know the right way to make a link that just removes the whole ?p=home. Because I want my home/start page to be variable free. I want it to be
http://www.example.com/
rather than
http://www.example.com/?p=home
Now I could just make the link
http://www.example.com/?
And then just remove the ? with the JS pushState(), but that would look pretty silly and would only work for JS users.
Let's say i would want to the do the above example with just the ? then I could create a link like this.
Link
<script src="SomeCoolPushStateScript"></script>
And I know from experience that this doesn't even work:
Link
So here comes the question: How do I remove the ?variable=something part of an URL when using an HTML href?
The path ./ should do the trick.
Link
If you want to preserve the main script name, like index.php, you will have to include that name.
Link
Alternately, you could dynamically generate domain-relative or absolute URL's with PHP.
You don't need to use querystrings.
Link
would go to example.com's root.
I don't recommend using "./". This would do what you want if the user is on a page that is in the root directory of your website (e.g. http://www.example.com/page.html). However, this would not work if they were on a page in a subdirectory. E.g. if the user's on http://www.example.com/hello/page.html, it would just link to http://www.example.com/hello/.
Using "/" makes sure the user goes to the root of your website.
I am just developing a theme under wordpress twentyeleven theme. In that theme I have installed widget logic plugin to show different widgets on different pages. But when I want to show some widgets in post page and made conditional tags for widget logic the widgets are not showing in post page.
I have tried some thing conditional tags like this
is_page('Blog')
is_page('246') // As 246 is the page id of my post page.
I tried all of them but still its not showing.
I had also tried wp_reset_query(); in my functions.php file. But no luck there was.
Update
To make blog page as my post page I have made changes in wordpress settings >> Reading >> A static page >> Post page -> Blog
So can someone kindly help me to solve this? I have already spent a day to solve this. Any help and suggestions will be highly appreciable.
Just try this in your widget conditional
is_home(Blog)
Here is the link http://wordpress.org/extend/plugins/widget-logic/other_notes/
Just check there is_home() -- just the main blog page
try is_page(246) without quotes.
I have made a homepage in Joomla 2.5, and I need my front page to be different then the page made in Joomla.
My best solution then, is to make the front page in pure HMTL, and then redirect to the site made in Joomla. Is this possible? or is there an easier way to do it? for example with a plugin or something?
Create a custom html page and create it an article and then assign this article to front page. In this way you can display your custom html page to hope page of joomla.
Further if you want to remove even the headers and footers of the joomla page for home page this can be done in various ways
Make module positions and display the header and footer in it an
then in admin do not publish these modules for home page
We have
variable in template index.php which give us flags weather this is
home page you can use this flag and put a condition like if this is
home page dont display the header and footer.
Hope it will help you.
I can't really understand your question. If you want to load HTML only use custom HTML module rendered in your homepage
What are you trying to achieve? Without knowing more, I have two thoughts.
a. Joomla uses index.php. A lot of the time web servers look for index.html first. So if you create an index.html file and upload it to your root folder, it will display that first and not read your Joomla! site. If that doesn't work, check your web server to see the order that it looks for your start page. That is a setting that can be changed. (Depending on your hosting situation)
or b. You can set different templates for a single Joomla! site. you could set a different template for the homepage compared to the rest of the site. (I just need to know more on what you are trying to accomplish)
Have a great one.