HTML And HTACCESS Not Working
I am trying to get PHP to run in HTML files. I have done it many many times with not a problem. However my latest attempt using this code:
RemoveHandler .html .htm (with/and without)
AddType application/x-httpd-php .php .htm .html
Returns a 500 Internal Server Error. I have no idea why, and it is critical i get this to work.
View Complete Forum Thread with Replies
Sponsored Links:
Related Messages:
Htaccess File Not Working Any Deeper
i've htaccess (using FILES ) all directory in my site so as to obtain personalize urls. It works at the first directory but any deeper, the apache or php (I don't know) seems to take forever to load up the file. It's not loaded at all. For example: http://www.domain.com/service/mh so mh is a php file. A htaccess file is inside the service directory. Its working but http://www.domain.com/service/a_folder/mh5 A htaccess file is inside the a_folder directory so as to redirect any request to mh5 php file. This directory is not working. I'm sure everything in my htaccess is correct. Any ideas why?
View Replies !
View Related
How To Use .htaccess To Parse Only .html Files As .php?
I am trying to make my server (Apache) parse .html files as .php. I found this line of code: ForceType application/x-httpd-php placed it in an .htaccess file and uploaded it to the directory I wanted it to work. And it worked; my .html files are all parsed as .php. But, apparently, so are my images, so they aren't loaded into the pages. And something else, my css file isn't found anymore by Netscape and Mozilla, while IE has no problem... I'm calling my css file with @import url(all.css); in the <style> block in the head of my .html files. How do I make the server parse _only_ .html files as .php, and why don't Mozilla and Netscape find the css file? (They did before I sent the .htaccess file)
View Replies !
View Related
How Can I Reliably Get An Html Path With .htaccess 'RewriteBase'
Hi, if I have a site htt://www.example.tdl/folder1/folder2/page.html I want to get the folders from the root, so the folder would be $f = './folder1/folder2/' and the page $p = 'page.html' I have 2 problems: First if the user does not enter a page htt://www.example.tdl/folder1/folder2/ How can I reliably get the folders and page? $f = './folder1/folder2/' $p = '' And secondly if I use RewriteBase in my .htacess, (I do that a lot). RewriteBase /folder1/ the user would enters still enter htt://www.example.tdl/folder1/folder2/ but the 'root' folder would now be '/folder1/' How can I then get the right path. $f = './folder2/' $p = '' Because if I use $_SERVER['REQUEST_URI'] then it will return $f = '/folder1/folder2/page.html'
View Replies !
View Related
Working With Html Forms
Let's say you have a html form that allows you to choose three options with radiobuttons (at this case). Well you select one option and click "Submit" to submit the form. Now when the action points to another URL where the actual PHP script is, how to call which option of the three available did the user choose so I can work with it? Code:
View Replies !
View Related
Mail() HTML Email Not Working
I have just signed up to a Virtual Server and I'm having issues with sending email via mail() in HTML format. I have a simple script to test the server and it's not working correctly. The receiving server does not understand it's an HTML email. On another server, this script works perfectly: Code:
View Replies !
View Related
HTML Redirects Quit Working
I have run into an odd situation on my home server. HTML redirects, via the <meta http-equiv="refresh"> no longer work. They show up in the web page code, if you choose to view it, but no longer execute. Strangely enough, I believe the problem was caused by my wife's cat using my server's keyboard as a path to repeatedly get from point a to point b and back again, so replicating how it broke isn't something I can do. I have been sabotaged by the deadly persian cat virus! I have restarted the server, but it did not fix the problem. Does anyone have any idea where I might look to try and undo the damage this feline has wreaked upon me? If not, I'll be spending a couple of days rebuilding the server again and cat proofing it this time... Server is Linux Enterprise 3.0, Apache 2.0 and PHP 4.0. Any assistance would be appreciated (and no, I can't get rid of the cat, as much as I'd like to).
View Replies !
View Related
Parse .html As Stopped Working
I recently upgraded an old 4.2.2 PHP to 4.3.11 One change I made after was to get my .html files to parse thru PHP. Yes, I've read for years not to do this, but I do anyway. I accomplish this by changing: AddType application/x-httpd-php .php to AddType application/x-httpd-php .php .html But now, all my apache redirects don't work, and the apache error pages want to download. The .html parse thru PHP, and ofcourse .php is fine. I've covered everything I know, and would like to know if anyone else has come across before.
View Replies !
View Related
Html Link For Local File Not Working
I tried a simple example for html link inside php file I have a file called file1.txt inside C: I put the following lines in a file and named it .html <html> <a href='C:file1.txt'> open file</a> </html> here the link works and the file opens upon clicking if the same file I named it .php and tried to run it using apache localhost here when you click the link, nothing happen and the file didn't open why?? knowing that if we put any website link it works , but if we put any file inside our computer it doesn't work.
View Replies !
View Related
Php Code Embedded Inside Html Page Not Working.
How do I make or workaround in my Apache server to parse *.html files for <?php ?> code embedded in it? Currently php recognises <?php ?> tag only if the file has a *.php extension. Any php code inside *.html or *.htm is ignored. Since I dont have admin access to the server or admin person, changing the php configuration is out of choice. Now I have to go thru echo and print statemnets to get it work. But it looks very cumbersome and prone to errors.
View Replies !
View Related
Working Connection... Not Working? (Advanced)
It has tons of modules, and obviously a config file which opens the db connection. But there is one, and only one, module having strange troubles. $query is just a simple INSERT INTO command. But it does not inserts anything. I only obtain... nothing. Neither an error from the server! Code:
View Replies !
View Related
Sessions Working, Then Not Working?
I wrote a login script (one that I have used on quite a few sites previously) and have found that it was working, then not working, then working again now not working - all without me changing any code. Here is the process: 1) l/p gets sent to login.php to query the db 2) if login successful, set $sid = session_id, and other session variables, register them in the session, and redirect to main.php 3) first thing on main.php is check_login function, all this does is see if $sid is set and equal to the current session_id(). If succeed continue to display data on main.php based on registered user data. If fail, redirect to error.php with the appropriate error code. this all takes place on a shared ssl server if that matters. The trouble I'm having is the check_login function is failing because no session variables are present, including $sid. I'm 99.9 percent certain it's not a code issue because 1) I have done this same script many times before with no trouble, and 2) this particular one was working before So I am really looking for php configuration issues to check on, or things like that.
View Replies !
View Related
How To Use Php In .htaccess?
hi, does anyone knows how to write php in a .htaccess file? coz all i want to do is to have every member his own database with his own username and password, so that only hisself can access his own directory. but my membership creation is a web-based, so that i can't create the user's own password database by hand, so it must be done when a new user is created automatically. are there any ways to do that? Also, I tried to use php to call htpasswd but it seemed didn't work by the script: exec("htpasswd -b -c /usr/local/apache/passwd/perry perry perry");
View Replies !
View Related
Htaccess And PHP
I have set up .htaccess for one of my pages... and one of the protected files is a PHP script. Now, my question is, I want to use the username from htaccess in my PHP script, how do I get it? Eg. you log in to my htaccess protected page and then you come to a page that say this "Hello, you are logged in as <username>"
View Replies !
View Related
SEO URL Htaccess
I want to convert my smarty urls to seo friendlly.For example index.php?mod=member&pg=user&a ct=list should be converted to mod/ member/pg/user/act/list Url can have N number of querystrings. All of those should be converted to seo friendly.Please suggest an htaccess code for this problem
View Replies !
View Related
PHP-.htaccess-CGI
I created a set of pages with PHP for login using a database. Now, I need to link to a lot of CGI programs in a folder with protected-access (.htaccess). The username and password are the same as the ones people use to login with. Is there a way to use the session usrname/password for the HTTP authentication to that folder ?? If I remove the .htaccess for that particular folder, then all those files will have access without any kind of authentication. I tried username:password@www.example.com . But this doesnt work with IE 6. So I need something else.
View Replies !
View Related
Htaccess Help
right now im testing the generated permalinks of my cms. i'm kind of learning htaccess rewrite.. but i dont get one thing. what does this exactly mean? RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d
View Replies !
View Related
Php - Htaccess
On my webhosting I don't have access to a root directory, so I am stuck in the public folder. I should secure the downloads folder, this is why I wanted to use a ..htaccess file. Only, PHP should have access to this folder..because users login using a username and password from the database. How can I make an htaccess file which allows the "php-user" to access the files in the folder on a Linux webserver?
View Replies !
View Related
.htaccess/PHP
Just wondering if this is possible: I want to use htaccess to authenticate different users. What I would then like to do is use the username from the htaccess box to set the session id of the pages. Furthermore, I would like to use this to keep a check on whether a user is logged in when they hit a page. This is so that I can deliver content appropriate for each user. This is an existing project where htaccess is being used. I'm just writing a backend for my customer so that their clients can log fault calls. Is this possible?
View Replies !
View Related
URL And .htaccess
I've protected a directory with an .htaccess file. I'd like some of the files in this directory to be accessible by a scheduler that runs an "URL". The problem is that the scheduler runs scripts in this directory, so the server asks a username and password. How to avoid this ??? Should I set the .htaccess file to allow GET, but how ??? and what would be the URL ??? directory tree: admin .htaccess admin.htm //frame adminmnu.htm //menu in frame script1.php script2.php script3.php
View Replies !
View Related
Using Php Instead Of Htaccess
I'm finding out that htaccess, while a decent way to secure a directory and its contents is not very programmer flexible. I was wondering how you could go about securing the contents of a directory by using php and mysql.
View Replies !
View Related
Php And Htaccess
i would like to know that ,how to get user name if i am using like that www.example.com/sijo i was used an htaccess file in it i have written RewriteEngine on RewriteRule P/(.*)$ index1.php?referer=$1 like that but in running site i did not the name.
View Replies !
View Related
Using .htaccess
i have set up a cookie using php. <?php setcookie("user", "student", 3600); ?> . is it possible to read that cookie using .htaccess? otherwise please inform me how to set and read cookies using .htaccess. please give me a link to such tutorial if there is one.
View Replies !
View Related
Htaccess Log Out
I set an htaccess on an admin folder for a news script through the folder permissions section in cpanel. Everytime I go to the admin folder it logs in automatically for somereason. Not sure if its just for me or for others aswell but can I make a log out link so it logs me out?
View Replies !
View Related
Php And .htaccess
I have written the .htaccess file and is in my doc root. the rule is something like this. RewriteRule ^test/?$ /view/os.php and so on, there are some 100 rules I have written. now I do not know , how to change the conf file so my php will read the link http://192.168.149.44/test/ and pass it directly to http://192.168.149.44/view/os.php can any idea, what are change and where so my PHP/apache will read the .htaccess file and do the stuff.
View Replies !
View Related
What's Htaccess ?
what's htaccess ? i don't know anything bout this thing and please someone to give me a brief explanation...bout what it is and it's function.. i read on http://httpd.apache.org/docs/2.0/howto/htaccess.html but is too hard to digest (i'm already confused) since i really don't know much bout apache (beside just using it as web server ^_^)
View Replies !
View Related
And .htaccess
I am building a website, part of which reuires user authentication. In the past I have used PHP and MYSQL to do this, but I was wondering if there is an easy wasy to use .htaccess. On the face of it this looks simple but each page the site returns is user specific, so I need a way of finding out which user logged in. For example if John logged in he would see page A If Suzy logged in she would see page B. I am thinking that there might be something in the page headers that I can get hold of, I'm just not sure what.
View Replies !
View Related
In .htm Without .htaccess
i have a large site and need the content pages to be .htm but i want to use 1 header and footer file (php includes)...tried useing the .htaccess files to run htm as php but cant on my windows server....is there any other way to do this?
View Replies !
View Related
.htaccess &
I have protected a directory with the help of .htaccess & htpasswd. I also read that I can get the login value in a php variable. Like this: $user = $_SERVER['PHP_AUTH_USER']; echo "User : "; echo $user;
View Replies !
View Related
Htaccess
When I try to go to a directory with mi Internet browser in order to display the files it contains, I get the following mention: Forbidden, you dont have permission to access /mydir/ on this server. Is there a way to acces to this directoy by puttinge an .htaccess file in it, and in that case what should I write into the .htaccess file.
View Replies !
View Related
.htaccess
Currently, I am using .htaccess rewrite to change some of the names of my URLs. However, I want to take it to another level. Currently, here is what I have: RewriteEngine On RewriteRule ^newsarticle/page/([0-9]+)/?$ newsarticle.php?id=$1 So if my news article was located at: http://www.mydomain.com/newsarticles.php?id=3, it will now be http://www.mydomain.com/newsarticles/page/3 However, I want it a little different. Rather than ending in with the ID number, I want the URL to have the title. If the news article title is Cool News Article, then I want the URL to be http://www.mydomain.com/newsarticles/Cool-News-Article Does anyone know what I would have to do to accomplish this task? p.s. All news articles are pulled from a database and the title is stored in the field called `title`.
View Replies !
View Related
Htaccess Auth Vs. Php Auth, Is Htaccess Better?
I have searched the forum and not really found an answer to my questions. I am debating forms of authentication, and I already have .htaccess apache authentication running. My question is, is htaccess a reliable enough form of authentication to not need anyother forms? I am just not sure which is the better method, php, or htaccess.
View Replies !
View Related
Htaccess To Read XML As PHP
I'm trying to write a RSS feed which will pull info from a mySQL DB. In order for the server to read the XML file as PHP, I've uploaded a .htaccess file to my server with this code in it: AddType application/x-httpd-php .php .xml Then, my feed looks like this:
View Replies !
View Related
Writing To .htaccess
I read "Blocking Badly Behaved Bots" and its predecessor, and I'd like to ask a relatively simple question: Assuming I already have the bad IP to ban (let's call it $ip), how would I write the IP to the appropriate line in .htaccess, and safely? I'd like to use a relatively simple script like this one: <?php $file = $_SERVER['DOCUMENT_ROOT'] .'/.htaccess' $fp = fopen($file, 'a'); fwrite($fp, "Deny from".$ip.""); fclose($fp); ?> But again, I'm not sure how safe this is, and it doesn't write the IP to the correct line. Any suggestions? I know the other anti-bot scripts do this, but it is very (needlessly?) complicated and I have not been able to block the IP in the right line. Please help out a newbie trying to defend his sites vulnerable forms!
View Replies !
View Related
.htaccess Validation In URL
I'm building my website and i wanted to put a htaccess in a protected dir... and place a login form somewhere to access my protected directory so my login collect username and pass and try to go at my dir specific url like this: user:pass@mysite.com but it works on some computer and doesn't for others. Is there any reason?
View Replies !
View Related
Php_value In .htaccess
I am trying to change some php settings via .htaccess. For example, these work: php_value upload_max_filesize 1000M php_value include_path .:/path/to/dir/: ...however, these don't: php_value post_max_size 1000M php_value upload_tmp_dir .:/path/to/dir/:
View Replies !
View Related
Htaccess Variables
When a user enters their name and password dose htaccess return the username as a veriable that can be used to identify the user and be passed to php. If so where can I get more info on htaccess.
View Replies !
View Related
Htaccess Manager?
I'm looking for a script that could administer htaccess scripts for several folders. Our website has over a hundred folders which need protection, and it would just fabulous if there was a script that could make it all happen from the same front-end. The server is a Windows-server, running php5. I've searched hotscripts.com, but all there was were either for a single folder or just didn't work.
View Replies !
View Related
Htaccess Problem
I have the htaccess code that is below to redirect everything to index.php exept for the mentioned folders. (img, swf, js and css) Now when i try to access domain.com/testfolder/img in Firefox i get redirected to domain.com/testfolder/img/?img How can i prevent this? And i was wondering if i could 'tell' the htaccess to use the folder it's in as root automatically. And somehow my values don't get passed to index.php. That doesn't make sense to me either ... RewriteEngine On RewriteBase /testfolder/ RewriteRule ^((img|swf|js|css)(/.*)?){1}?$ - [PT] RewriteRule ^(.*)$ index.php?$1 [L]
View Replies !
View Related
URL Rewrite + Htaccess
I have a domain, and i want every query string redirected to index.php? so domain.com/foo/bar would actually be domain.com/index.php?/foo/bar Then i want to be able to say in index.php, if QUERY_STRING == foo, do this etc. (How) can i do this with htaccess?
View Replies !
View Related
URL With .htaccess Or PHP Redirect?
I have a URL on my website that is currently under the directory mysite.com/something/ But I'd like to change the URL to mysite.com/anotherthing/ This is peasy to do, of course, but I have a really big Google ranking under the /something URL, and I'm afraid that if I transfer to the new URL, I'd lose all that. Is there a way to put all my content under /anotherthing, but make anyone typing in the URL /something still get all the same content in /anotherthing? ..htaccess maybe? Or PHP headers? Am I making no sense?
View Replies !
View Related
.htaccess Settings
I read in a PHP and MySql book that you can set auto_prepend_file into a .htaccess file in a directory on an Apache server and set up headers and footers for all files in that diretory. I gave this a try. Code for .htaccess: line 1- php_value auto_prepend_file "/footer.inc" Code in footer.inc: <center><a HREF= "javascript:window.close();">Close Window</a></center> I am getting an Internal Server error whenever I try and open a file in the directory. I remove the .htaccess file and refresh and the page opens just fine.
View Replies !
View Related
Authentication With .htaccess
When using authentication on Apache server with .htaccess and .htgroup, is it possible to use PHP to provide customised content depending on whether a visitor to a website is in a specific group or not? If so, does anyone know of a good tutorial?
View Replies !
View Related
|