Jump to content

Recommended Posts

Posted

I'm working on setting my webpage up with a single index.php file that injects HTML into itself from header.php, footer.php, content.php, etc. And I want to rewrite the URL depending on what content is loaded into the main container. So after header.php, it would load content.php, and the PHP script will be setup to search based on which menu item was clicked for a stub like "/content/stub/latest-news-1.html" and inject the file name into the <div name=" ">, and the HTML contents between the <div> tags. The injected HTML would be something like:

 

<div id="main-container" style="main-style" name="latest-news"><p>Some info goes here</p></div>

 

... and another script to write the URL as

"example.com/latest-news/1/".

 

But whithout changing the .htaccess contents, the URL rewrite script in PHP will make the URL look like

"example.com/index.php?/latest-news/1/"

 

What I need to do is modify the .htaccess file to rewrite "index.php" as "/". The trouble is, HelioHost, like a lot of other host companies, hide the .htaccess file from the File Manager as well as from FTP. You can't upload .htaccess directly to the root folder without an error telling you the file already exists. But you can upload sample.htaccess to a sub-folder, rename it to .htaccess, then move it to the root folder - overwriting the previous file. But not having access to the original .htaccess file, I don't want to replace it with a version that removes needed instructions found in the original.

 

Can someone please post the original .htaccess file contents, or at least the settings (if any) that may affect site functionality so I don't accidentally cripple my page?

Posted

.htaccess is not hidden in FTP. I see mine in Filezilla using the default configuration. If you cannot see it, either your FTP client does something to hide them (in which case get another client) or it does not exist (in which case the issue is moot).

 

Also, in the file manager there is an option to show hidden (dot) files when you initially select the directory in cpanel.

 

The contents of the .htaccess in my public_html folder is:

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName rax.heliohost.org

Worth noting that this is on a Stevie account. On my Johnny account, there was no .htaccess in public_html by default.

Posted
On my Johnny account, there was no .htaccess in public_html by default.

 

I'm on Johnny, that explains why it wasn't showing up in FTP. I had to add a specific .htaccess file into a sub-domain, and that one vanished as soon as it was put there from File Manager, but I didn't have my FTP client setup yet when I did that. So I guess, as you said, the issue is moot. But I don't see an option in the file manager to show the hidden files, the only changeable setting I can see is to Disable Coding Verification Dialogs. Could be that's just on Stevie?

 

At any rate, since I don't have to worry about overriding any settings, and I should be able to see it in FTP, there's no point in wondering. To be safe, I'll keep a bakup.htaccess file on my computer in case I need to make changes.

 

And thanks for the prompt response, Wolstech! If I lived closer, I'd invite you over for some scrapple and eggs, but since I can't get Rapa brand scrapple this far south, you'll have to eat it on your own... lucky b*stard! ;)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...