Jump to content

Search the Community

Showing results for tags 'htaccess'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 7 results

  1. Securing my upload folder “upl” The upl folder is used to store anything that is uploaded by the user for their needs that is not a part of the back end, as such all content in this folder is subject to being locked down and and supplied after checking credentials. The upl folder has an .htaccess file that locks down all remote access. order deny,allow deny from all When something is needed from this directory we jump that wall with the help of apache after credentials are verified. I think this is straight forward so far. For images something like; <img src=”downloader.php?app=1&id=20&type=thumb”> For files something like; <a href=”downloader.php?app=1&id=20&type=file&fileid=1212”> After we check creds, we use similar to below to get data from that locked down folder. $size = filesize($file); header ( 'Content-Description: File Transfer' ); header("Content-Type: application/force-download"); header ( 'Content-Type: application/octet-stream' ); header ( "Content-Disposition: attachment; filename=\"".basename($file)."\""); header ( 'Expires: 0' ); header ( 'Cache-Control: must-revalidate' ); header ( 'Pragma: public' ); header ( 'Content-Length: ' . filesize ( $file ) ); ob_clean(); flush(); readfile ( $file ); exit(); seems to work pretty swimmingly for the most part. My problem is (or at lease a mild nuisance) is that it seems that these images loaded in this manner are not subject to the cache system of a browser? It looks like they reload every time a page is visited. Is there a way around this?
  2. Hi all, I've done something similar with my wp-content folder where I protect the files from being downloaded if you are not logged in and everything works just fine. With the following code I am trying to say: #if the user doesen't have the cookie "wordpress_login_in" # and the url is wp-json ... # redirect to google RewriteCond %{HTTP_COOKIE} !.*wordpress_logged_in.*$ [NC] RewriteCond %{REQUEST_URI} ^.*wp-json/wp/v2/(users|comments|posts|pages|media|types|statuses|taxonomies|categories|tags|settings) [NC] RewriteRule ^ http://www.google.com [NC,L] Can anybody tell me why the script doesn't work? I am still seeing the JSON file (i have tried redirects from files and folders and everything seems okay. I've also tried creating wp-json folder but then that breaks the api from displaying)
  3. I have URLs of my project on my localserver like localhost/shareboard/users/login in which (users is my sub directory and login is php file named login.php) I am already using the following htaccess rules for this Options +FollowSymLinks RewriteEngine on RewriteRule ^([a-zA-Z]*)/?([a-zA-Z]*)?/?([a-zA-Z0-9]*)?/?$ index.php?controller=$1&action=$2&id=$3 [NC,L] Is there a way of removing sub directory only from URLs without changing above htaccess? or some other idea that gives result as localhost/shareboard/login (In my php code i am using the above address in hyperlinks as <a href="<?php echo ROOT_URL; ?>users/login">Login</a> And the following lines are added in my config.php file define("ROOT_PATH", "/shareboard/"); // I am using this one for linking files define("ROOT_URL", "http://localhost/shareboard/"); // and using this one in hyperlinks Please guide me if there is a possible solution for what I want to do. Thanks🙂
  4. Hi, i never worked with .htaccess files because i didn't use it for anything, now i need one and i'm stuck into this. I made a rule to remove .php extension from file and to make a url like this "localhost/blog/My%20first%20post" Now i need to replace that white spaces and make a url to look like this "localhost/blog/My-first-post" Here is my .htaccess file RewriteEngine On # Removes .php extension from inner_blog.php RewriteRule ^blog/?$ blog.php [NC] # Remove inner_blog.php and changing it to blog/articlename RewriteRule ^blog/([^/]*)$ /inner_blog.php?title=$1 [L]
  5. I have a domain where I installed a SSL certificate. It works if I type in the domain like this "https://mysite.com". But if i go to the domain with www or without www, the SSL secure certificate won't show in the top bar. The site loads up fine. Here is my .htaccess code. Am I doing something wrong? RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com RewriteRule ^(.*)$ https://mysite.com/$1 [R=301,L]
  6. I have written rewriterule in htaccess for accessing category page. Category page working file, but my subfolder not browse which contains other files. You can see code below ------------------------ Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Za-z0-9-]+)/$ category.php?category=$1 ------------------------ e.g. If i access the page http://example.com/international/ Its showing the category result page. This is working perfectly. But when i tried my subfolder which exists on root directory, not accessible because of rewriterule written above. Its showing same category page like international. http://example.com/subfolder/ subfolder = is the subfolder exists
  7. I am working on a site redesign and as part of that I want to do an url rewrite. Currently my page looks like /rules.php?title=Ax+men i would like them to look like /Ax-men. Keep in mind that the title will change and can contain letters an numbers I have done this before with numbered pages but am not sure how to adapt it to a variable length and text and numbers. This will also have to work with pagination, and with old back links that might be out there This is what I had on a different site #Options +FollowSymlinks #RewriteEngine on #RewriteRule ^(.*)\.htm$ $1.php [nc] Options +FollowSymlinks RewriteEngine on RewriteRule ^story-([0-9]+)\.html$ story.php?currentpage=$1 Mainly looking for tips and pointers
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.