Newly added file requires .php extension, old files do not - php

I am taking over for a developer who left a website running a linux/apache on freebsd. I need to add a php page to the site. He used Smarty templates as well. I copied an existing php page and its corresponding template file. Made changes to the template file and it created a compiled newfile.php.tpl file in the compiled directory.
All the php files can be accessed WITHOUT the .php and work fine. If I refer to the newfile without .php I get a 404 error, with the .php it works fine.
.hataccess. I have done a find on the the system and for this website, there does not appear to be a .htaccess file. Even if there were the rest of the pages work fine without php extension.
Things I tried grep for the mod rewrite, i did a find on .htaccess, i rebooted. So is there some cache i am missing or some other basic thing, apache, php? I have put in about 12 hours on this. The only thing i found remotely was a url_rewriter.tags section in a phpcgi.html file.

Went to lighttpd.conf file researching #rodneyrehm sugg. I found a fastcgi.server section and there is a
url.rewrite-once = (
section of code with the specific pages for the site. So I added my new page and all is well.

Related

PHP can't file contact.html, but it shouldn't exist? (Smarty Engine)

I've got a legacy PHP project to fix a thing or two. I've downloaded it via FileZilla and served it on my local machine with a local copy of the database. The project is exactly the same with the live one, yet the live one can open the url/contact.html but on my machine it says no such file is found. All other pages go for url/categories/ or url/products/ so I've tried altering the url but no use.
All the other pages within the site are simple: one .php controller one .php model and one .tpl smarty template view. Requiring no .html at all. But this one is somehow different. The .htaccess file is exactly the same as the live version. I've tried adding a rewrite rule to direct every .html to .php but didn't work. I'm lost and out of options, please help? It doesn't even have to be an answer,"Try looking into that" would work too.
I'm working via XAMPP on windows, and I've configured the https:// to http:// on my project but that's all. Even hidden files are checked and confirmed.
have checked that contact.html is a static file (like a real existing html file?)
is there some kind of "routing" within the PHP of the project? If there is route urls might be really anyware.. in the mysql database, redis, a json file and whatnot.. have seen them all.
try to debug where and how it works on the "production" server by using some logging to a file edit the file through filezilla and log to a 'mylog.log' file until you find out what is going on.. or if the site is not used all the time by clients - you can just try to echo stuff to figure out how this exact /contact.html works

How could I navigate directly from the toolbar menu without manually editing it

I am having trouble when navigating through some pages because when clicking on a menu item it goes to
http://localhost/drupal/admin/structure
and its giving me this error
The requested URL was not found on this server.
but if I manually added index.php after the site name
http://localhost/drupal/index.php/admin/structure
It does work. How could I solve this issue?
Looks like you don't have enabled apache server rewrite engine (or alternative if you have some other web server). To use aliases it has to be working.
If it is enabled check if you have .htaccess file in webroot dir. If you copied your files from somewhere it could happen that hidden files (those starting with dot) are not copied.

How to install wordpress on website using direct admin

I'm a complete noob with wordpress and i'm trying to install it on my server.
I'm following the instructions on this site but when I get to step 5 and I go to the http://example.com/direct-admin/install.php I get this error:
Not Found
The requested URL /wp-admin/install.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
In my folder 'example.com', located in the 'domains' folder, I started with only stats and logs folders. The first time I added the Wordpress files in the 'example.com' folder.
I tried adding a public_html folder and putting the Wordpress files in the public_html folder but that didn't work either.
How can I install wordpress on my website?
What server are you using? There are several ways of installing WordPress, I would strongly recommend using the WordPress CLI to install WordPress. All you have to do is follow these steps:
Download the WordPress CLI using these five steps.
Use now the CLI to download WordPress:
$ wp core download
Create the wp-config.php file
$ wp core config --dbname="your_db_name" --dbuser="your_db_user" --dbpass="your_db_password"
And then you can put your website URL in your browser and continue following the wizard, WordPress will ask you what site name, username and password do you want to use.
If you're having trouble setting up a wordpress installation and you're getting 404 errors or "apache is function normally" then it's possible that your DNS/server settings aren't correct, this was my error.
First try creating a .html file with a simple text editor by copying the html markup below into a new file and then save it as index.html
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading<h1/>
<p>My first paragraph.</p>
</body>
</html>
</code></pre>
And upload that to your server.
If you're still having errors you know it's not the wordpress installation that causes these but it's your server settings.
You should:
check if you are putting it in the right folder (like f.e. public_html)
make sure that your DNS configuration is correct
Check this answer for more information on how to setup your server to view a simple .html file.

Change Website from Plain HTML to Wordpress

I have a static html website that I need to convert to Wordpress. I was able to successfully load wordpress on my hosting and configured a theme. However, the front end still displays the original html page. I need the whole website to be converted to wordpress, but I can't figure out where to add the htaccess and index.php files as I read from a blog. Someone help out.
Thanks
Sam
1) you're kind of asking for the whole of how the internet operates. I'm not saying that to be confrontational, just know that you'll likely be downvoted for such an impossible question.
2) more to the point, your server is looking for a directory index. In general, most servers look for index.html, index.htm, index.php, and then others, but in that order. If it encounters index.html in your directory then it stops and says that is the file to load.
3) you can get around this by changing the name of your file.
"index.html" -> "index_OLD.html" (or any name not index.html)
4) you can also change the way your server processes the index order using the DirectoryIndex directive in your HTAccess file. Ask your hosting provider about how to do this and if it's supported (although, I don't recommend you do this, it's just an available option).
5) your wordpress install should be in the root directory. That is to say, your .htaccess and index.php files should live in the same directory that your current index.html file lives in. Once the html file has a different name, the server will locate the php file and use it to server up as the directory index.
6) good luck friend!

Joomla moved, now index.php redirects me to root folder

A friend of mine asked me for a favour, to move his website. The programmer who made it, send me an archive with the database, and the rest of the files needed. I've installed it on my localhost, with apache, php and mysql installed on it.
I have a problem with it. If I go to localhost/mgro/index2.php, it shows somehow a minimal version of the website, but if I click on something, it gets to index.php?something_else_here and it works. If I go to localhost/mgro I just see the files, and if I go to localhost/mgro/index.php it redirects me to localhost/mgro.
About the configuration file, I've used the configuration.php-dist file, with new info in it. What I've changed was just the database, user and password for the database.
Basically, everything works fine, except that index.php with no requests, because it "backs" me into the folder
NEW PROBLEM: If I click on an Add to cart button, it redirects me to the website that is online.
Is this Joomla 1.5 or Joomla 2.5.x / 3.0? I'm going to guess that you have a potential issue with the live_site variable in the configuration.php file, especially if you're using Joomla 1.5. Make sure that it is configured to your localhost's live site URL directory.
Some other things to check:
1) If you're using SEF urls you need to use a .htaccess file. Usually the one Joomla' includes by default works (if you don't have it you can redownload it from Joomla's code repos: http://joomlacode.org/gf/project/joomla/frs/?action=index
2) When logged in go to global configuration and check the option "URL rewriting". You can try switching it off. (On does require the .htaccess file mentioned before).
3) If you're just seeing files when you hit the directory then Apache isn't configured to load .php files. Since you're running a localhost you'll have to track that down somehow.
Some other notes:
-Index2.php isn't anything, don't use it.

Categories