hey people . i have a question and i dont know where to post it .
i want tow wrtie .htaccess file that rewrite the url of my links as well as increate my websites memory , i mean the size of the uploaded files and so on .

i opend too many tutorials but i couldnt understand anything , they use to post some good codes but they done explain them . please tell me how to write .,htaccess codes or please give me a link which can help me .

thanks alot

Dani AI

Generated

Quick, practical guidance for (and anyone who finds this thread later): URL rewriting and raising PHP limits are two different tasks that can both live in a .htaccess file — but they depend on server configuration. Rewrite rules need Apache's mod_rewrite enabled and AllowOverride set to permit rewriting. PHP settings set with php_value/php_flag work only when PHP runs as an Apache module (mod_php); on CGI/FastCGI/PHP-FPM hosts those lines will cause a 500 error. Confirm the environment with a phpinfo() page and check the Server API value.

A minimal friendly-URL pattern (place in the directory whose URLs should be rewritten):

RewriteEngine On
RewriteBase /

# skip existing files and dirs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# route everything else to index.php (front controller)
RewriteRule ^(.+)$ index.php?page=$1 [L,QSA]

For upload/memory limits (works only under mod_php). Example .htaccess directives:

php_value upload_max_filesize 20M
php_value post_max_size 25M
php_value memory_limit 128M
php_value max_execution_time 300

Remember: post_max_size must be larger than upload_max_filesize. If PHP is running as FastCGI/PHP-FPM, use a per-directory php.ini or .user.ini (supported since PHP 5.3+) or set runtime-safe values with ini_set() inside scripts. See PHP manual for directive descriptions and changeability: PHP configuration directives.

Troubleshooting checklist: verify mod_rewrite is enabled and AllowOverride includes FileInfo or All; inspect Apache error logs for 500s after editing .htaccess; use phpinfo() to confirm effective PHP values and Server API; test changes in small steps. If running a private server, put these rules in the main Apache config for better performance. This builds on 's note about placement and ' pointer to Apache docs.

Recommended Answers

All 2 Replies

the .htaccess goes in the lowest folder it needs to affect. So if it has stuff for the whole site (eg. the location of your error handling files) it should go in public_html or the site's root folder if that is not public_html (on shared hosting)

If you're redirecting a url in a directory that is still available, then the redirection instructions for that url must go in a .htaccess file in that directory, or they won't work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.