.htaccess

Do PHP scripts work if htaccess url rewrite is implemented?

If I use mod-rewrite to change a url like this: http://www.mysite.com/page.php?title=my-name-is-john to http://www.mysite.com/page/my-name-is-john and if the page.php file contains a script that relies on parameters passed through the url like: $_GET['title']; Then will that script still work after the mod-rewrite has been imple...

301 redirect everything to new root?

I am trying to do a 301 redirect of everything from an old subdomain to a new. I have a simple .htaccess Redirect 301 / http://www.smartphonesoft.com/ However if I goto the old URL with a subdir, it tries to redirect to the new domain with a subdir and fails. ie http://forum.smartphonesoft.com/reminder/ goes to http://www.smar...

Domain name slash user name redirect to PHP page

Hi, I would like to find a way for users to be able to type their username after my domain name to access their public profile page. For example, if you type youtube.com/username it shows that user's channel page. The resulting page is the same as youtube.com/user/username. So with my website, I have mydomain.example/users/profile.php?na...

Changing 'memory_limit', 'post_max_size', and 'upload_max_filesize' in .htaccess file

I know there are a lot of questions on here about this, but most of them seem to be from people who don't know that 'memory_limit', 'post_max_size', and 'upload_max_filesize' are PHP_INI_PERDIR (i.e. they can't be changed using ini_set()). I already learned that the hard way. However, everything indicates that I should be able to change...

Simple URL Re-Write Rule Not Working

Hello, I am trying to re-write this: http://www.domain.com/sample/comments/68 Into this: http://www.domain.com/sample/comments/index.php?submissionid=68 Here is what the .htaccess file looks like in both the directory represented by "sample" above and the directory "comments": RewriteEngine on RewriteRule ^comments/([0-9]+)?$ ind...

Serving images from outisde of document root

Is it possible? Let's say my directory structure looks like this: /data /data/images /public The document root is in the "public" directory. This won't work, of course: <img src="/../data/images/1.png" alt="" /> But maybe it's possible to enable serving images from directory above document root somehow? I would like to know. ...

mod_rewrite add trailing slash

I am using a .htaccess file to direct requests for a directory to a custom php file that provides info about that directory (and i want the url displayed by the browser to not change). Here is the relevant part of the .htaccess file. RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.*)$ /myphp.php?url=%{REQUEST_URI} [QSA,L] This wor...

Mod Rewrite to rewrite *.html files (CodeIgniter)

I'm sure this is probably really simple, but my knowledge really isn't good in this area, and I don't seem to be able to get it right. I have the following file structure: /cms (renamed from system) cms.php (renamed from index.php, added to DirectoryIndex in .htaccess) .htaccess index.html page1.html /css /js I also have the .htacce...

Urgent: how to stop htaccess to work on a subdomain?

hi, i have a website, lets say: http://www.domain.com/ and im using rewrite module but! i have a subfolder forum.domain.com and i dont want the htaccess to affect this directory, how to do it? please, its real urgent ...

mod-rewrite rule for sitemap.xml

Hi, I am using a CMS that hosts multiple websites simultaneously and I am seeking a method to properly serve sitemap.xml files for each site. I have concluded that a mod-rewrite rule will be the most effective solution for this. My idea is to have a /sitemaps/ directory with the site map for each domain named as the domain name, i.e. /...

How do I make the browser display the clean URL on a re-write?

Hello, I have a hyperlink that looks like this: http://domain.com/sample/comments/65 And when I click on it, it goes to this: http://domain.com/sample/comments/index.php?submissionid=65 I'm using a rewrite rule to make it do this. This is what I want, except I also want the URL displayed in the browser to still look like "http://...

Problems breaking an .htaccess redirect out of an infinite loop

So I have asked for help over at my weblog, scoured the internet, and pored over the examples you all have provided on here before, and I still cannot find an answer that works. Simply put, I am trying to take all traffic referred to my site from Site A, and redirect it all to Page B within my domain. I have gotten the redirect to wo...

.htaccess pretty url problem (mod_rewrite)

I have a directory that lists products by categories. if a _GET variable exists, it is used in a query. I would like to use "pretty url's", like: example/a/1/b/2/c/3/d/4 becomes example/index.html?a=1&b=2&c=3&d=4 most .htaccess examples I see only use variables to replace the _GET values, but I can use rules like this: Options +Follow...

Simple Multiple Product Links in .htaccess file are not working

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-zA-Z0-9_-]+)\.html$ product.php?pid=$1&rewrite=1&%{QUERY_STRING} [L,QSA,NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-zA-Z0-9_-]+)\.html$ product2.php?cid=$1&rewrite=1&%{QUERY_STRING} [L,QSA,NC] R...

.htaccess mod-rewrite conflicting with subfolder auth

I have a site which redirects all requests for files/folders which don't exist to an index file using .htaccess: RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule !admin/* index.php [NC,L] There is a folder "admin/" which has the f...

Simulate file structure with PHP

I'm running PHP on a shared Apache web server. I can edit the .htaccess file. I'm trying to simulate a file file structure that is not actually there. For example, I would like for the URL: www.Stackoverflow.com/jimwiggly to actually display www.StackOverflow.com/index.php?name=jimwiggly I got halfway there by editing my .htaccess fi...

How to make Django url dispatcher use subdomain?

I have a vague idea on how to solve this, but really need a push :) I have a Django app running with apache (mod_wsgi). Today urls look like this: http://site.com/category/A/product/B/ What I would like to do is this: http://A.site.com/product/B This means that the url dispatcher some how needs to pick up the value found in the subdo...

Change file upload size in linux server

Hi I have to upload a pdf file with 34MB. My site is in Linux with php. But my site support only 8MB. (I know this from phpinfo). How I increase the size? I heared that we can change it in php.ini through. htaccess. But where I get php.ini? How I change the size?. Does any one give me a solution ? ...

.htaccess cant pass variables to rewrited page on WAMP

I was coding few php pages to display customer quotations, on rep.php, user can click view details button (POST quoteID as the variable to quotedetails.php?quoteID=Q123456) to view the detailed info about a particular quote. Then I use .htaccess to make all php pages to html extention and rewrited url from 'quotedetails.php?quoteID=Q12...

how to restrict website access to a couple of web pages and ip address only, using htaccess.

Hello Using following Options +FollowSymlinks RewriteEngine on RewriteCond %{REQUEST_URI} !/temp_page.php$ RewriteCond %{REQUEST_URI} !/thanks.php$ RewriteCond %{REMOTE_HOST} !^90\.333\.222\.111 #RewriteCond %{REMOTE_HOST} !^127\.0\.0\.1 RewriteRule $ /temp_page.php [R=302,L] can allow myself (ip) to view all pages, and other get...