Add A Line To My .htaccess File So That It Does Not Redirect On Xml Files?

Oct 18, 2009

I need to add a line to my .htaccess file so that it does not redirect on xml files, so that I can submit sitemaps to google. My site is relatively large, so I am adding a separate sitemap for each subcategory. My existing .htaccess file looks like:

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$ /index.php?cat=$1&subcat=$2 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /index.php?cat=$1&subcat=$2&product=$3 [L]

View 3 Replies


Mod_rewrite And .htaccess - Redirect Script To Search Files In Inner Catalogs

I have a catalog /images and this path is used in a script. I need to redirect script to search files in inner catalogs - /images1 /images2 etc. I have such .htaccess but it doesnt work.

RewriteEngine On
RewriteOptions Inherit
RewriteBase /
RewriteCond %{REQUEST_URI} !^images/ [S=5]
# skip next 5 rules (number of lines following, i.e. 2*NDIR+1, where NDIR is number of imgdirs)

View 3 Replies

Redirect Using .htaccess File?

I have a file as "documentRoot/app/webroot/myFile.php" I need to be able to access this file at "mySite/myFile.xml" ie when i type myFile.xml a call should goto "documentRoot/app/webroot/myFile.php" How can i do this by using .htaccess file??

View 2 Replies

.htaccess Redirect If File Exists

I need to use .htaccess to redirect to one page or another based on if a file exists in the directory. basically I need al visitors to index.php to be sent to home page or splash page if splash.php exists in the directory, so far i have this...

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} index.php
RewriteCond %{DOCUMENT_ROOT}/splash.php -f
RewriteCond %{SCRIPT_FILENAME} !splash.php
RewriteRule ^.*$ /splash.php [L]

This sends visitors to [URL] if it exists only if i specifically have index.php in my address, it doesn't work if just type [URL]. I understand the first 3 lines of my code, but not the splash.php -f bit (i got that from some other redirect code i found on here). How do i redirect to home.php if splash.php not present?

View 4 Replies

A Line In .htaccess File?

ErrorDocument 404 /index.php

what'are the line meaning and aim in the .htaccess file

View 4 Replies

Htaccess Rewrite Rule To Redirect To File Or Not?

I have been trying to write a set of htaccess rules that will do the following:

With the url: [URL]

If a file called blog.php exists in the web directory(the directory with index.php in) then redirect to blog.php?url=something If blog.php does not exist, redirect to index.php?url=blog/something

EDIT: [URL] is an example, it could be any url string and the htaccess should search the web directory for a file corresponding to the first part of the url string, which in this case is "blog"

In both cases I can then use $_GET['url'] to get parameters from the url to intiate whatever actions in my php script.

I currently have:

Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/(.*)$ $1.php?url=$2 [L]
RewriteRule ^(.*)$ index.php?url=$1 [L]

But unfortunately this is not working, I'm not sure why, I'm proficient enough with php but my htaccess skills are pretty limited. I don't know if the [L] option is the one I should be using or if I should be using more options. Currently whatever the url string is, $_GET['url'] returns "index.php".

View 1 Replies

.htaccess Redirect If File Doesn't Exist?

So here's what I'm trying to do. I have a simple framework and I am using mod rewrite to rewrite the urls so that they point to the correct files. I have a process folder which sits inside the web folder (the web folder is where all the actual website files like images, css, etc are).This works great but what I am trying to do now is to have a default.php file to process the forms. The file works great if I point the form to it but I want to be able to point the form to it's proper file and if the file is not there then it uses the default.php

The forms are create by a class and the action is set to go to process/{ID OF THE FORM}.php The idea is that anyone can create a form using the class and if they don't need to do anything special, the default.php file will process the form.I realize I can just set the form class to always use the default.php and then on the default.php file I can check if the proper file exits. If it does, then use that file, if it doesn't then keep processing the form but I am still curious to know if something like this would work on mod rewrite:

RewriteRule ^process/([^/]*) /web/process/$1
RewriteCond %{DOCUMENT_ROOT}/web/process/$1 !-f
RewriteCond %{DOCUMENT_ROOT}/web/process/$1 !-d
RewriteRule ^process/([^/]*) /web/process/default.php [L]

View 3 Replies

.htaccess - Use Rewriterule To Redirect To A File In The Same Folder?

I would like to take requests for /somefolder/style.css and handle them with /somefolder/program.php So, I put the following in my .htaccess file:

rewriteengine on
rewriterule ^style.css$ program.php?css=1 [R=302,L]

The result is that instead of redirecting to /somefolder/program.php, the server tries to redirect to:


How can I get rid of the /var/www/html/ in the redirect? I thought that since I just entered program.php in the .htaccess that it would default to the same folder. Since this is a generic script that I will use in many places, I would like to avoid using rewritebase to specify the folder I'm in -- the .htaccess has to work in any folder without being modified.

View 2 Replies

Htaccess Rewrite - Folder Redirect To File

I want the user to enter URLs similar to this: [URL] (never underestimate the stupidity of the user, so I want it to work with or without the last slash) The folder /thisuser/ (or whatever else is entered) does not exist. This should redirect the user to: [URL] And for some reason I can't get it to work. All I get is either Firefox or Error 500 telling me about redirecting loops. I keep seeing this version here that should work, but for some stupid reason it just won't for me:

#Options +FollowSymlinks
Options +FollowSymLinks -MultiViews
# // found -MultiViews somewhere and tried it without success
RewriteEngine on
#RewriteCond %{SCRIPT_FILENAME} !-f
#RewriteCond %{SCRIPT_FILENAME} !-d

According to one or two different forum posts I found, this should be exactly the code I want. Why does it create these loops?

View 5 Replies

Redirect Any Subdomain To The Main Page In The Htaccess File?

If I was to set my site to redirect any subdomain to the main page in the htaccess file like so:

RewriteCond %{HTTP_HOST} ^(.*)
RewriteCond %{HTTP_HOST} !^ [NC]
RewriteRule ^(.*)$ [P]

Would this mean that if I was to type in it would redirect and show in the address bar or would it stay showing

If it's the former, is there a way to make it so it stays displaying [URL] so that I can redirect it to a folder or would it be better to make the index file of the site check the address of the site and use include to display the necessary page?

View 6 Replies

Get .htaccess File To Redirect Only Certain Pages / Folders To Https?

I'm trying to get my .htaccess file to redirect only certain pages/folders to https and if its not the pages that need to be encrypted then it should shoot the user the the http page. Also I would like to be able to list certain folders that can either be HTTP or HTTPS

Here is what I tried using writing up myself. But seemed to not work all correctly.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{SERVER_PORT} 80
RewriteCond $1 ^(myaccount|payment.html)


View 2 Replies

Htaccess Redirect To Same File But Display Different URL Without Having To Change Internal Links?

I currently have links on my website in the form of:- [URL] I want that once taken to the destination of the link, the url displays something like:- [URL]. The file on my server is the same file, but only the url should appear neater without me having to change any of the links. I tried the following, but found it only useful if I explicitly changed the internal links:- RewriteRule ^new$ products.php?cat=10

View 2 Replies

Htaccess - Use Script And/or Htaccess To Rewrite A URL But Not Redirect?

Is there a way I can use PHP (and/or .htaccess) to rewrite the URL of a page. For example if a user goes to[URL] they are actually accessing the page which is [URL] But not a redirect.

View 3 Replies

.htaccess File Causing JS And CSS Files From Being Called?

I have an .htaccess file working in my website. I found out that javascript and CSS files are not called if the path of each of these files are not set to absolute. I changed all the URL paths to absolute in my smarty template and javascript files, and not it's working.

Now in for my php files, I have require_once all over many php files. I was just wondering if I also have to set the paths in the require_once to absolute?

View 2 Replies

Setup My Htaccess File To Read My Html Files As Php.

I am trying to setup my htaccess file to read my html files as php. How would I do this, or where can I find how to do it?

View 1 Replies

Database And Displays The Mp3 Files In Xml Format With An .htaccess File?

A php page where browse for and upload mp3(sermons)to our website(lets call this page A).Put together a page(page B)where it loops through the database and displays the mp3 files in xml format with an .htaccess file to make the php page show up as an rss feed.Registered with iTunes and they have accepted my submission for my podcast but have said that if my files do not show up immediately click on a link and 'ping' the iTunes server to refresh the feed.

Link opens a new window communicating that the pinging process is taking place or something.A php file go to that pinging url in the background without the user knowing about it or seeing a new window open because they're not going to know what they're looking at and then they would have to close an extra window.

View 3 Replies

Uploading Of Larger Files, Ini_set(), .htaccess File

i set the values of upload_max_filesize and post_max_size through the . htaccess file. I managed to change the local values but i cannot change the master value of the php. ini. I tried uploading bigger files but still i cannot. . . what seems to be the problem here??? do the local and master values have to be the same for me to be able to upload large files???

I cannot locate the php. ini so . htaccess is my only choice of setting the values any idea??? I also tried setting the values through ini_set() but still no luck..

View 5 Replies

Config .htaccess File To Acess Files Outside The Document Root?

I am designing a music website..I am designed the music player with flash.I have xml file like this where my flash player play the songs from the url..I have a folder named songs.

<track>Princess Song</track>
<artist>Artist Two</artist>

My document root folder is public_html(web accessible directory) I have to restrict the download of my songs direct from http and have to prevent to downloading the songs.if i move the songs folder outside the public_html folder,.for example /root/songs

<track>Princess Song</track>
<artist>Artist Two</artist>
<url>/root/songs /princess.mp3</url>

whether my flash player works or not?.how to config the .htaccess file to provide access for the xml file to play the songs outside the document root or public_html accessible directory.else I am placed the flash player in Iframe..whether it possible to move the flash player outside the document root or public_html accessible directory and provide the path in home.php access the flash player. how to config the .htaccess file to provide access to the flash file outside the document root or public_html directory?.

View 4 Replies

.htaccess - Download Htaccess Protected Files Using CURL

I tried to download files in a htaccess protected directory using php and curl. This is my code:

$username = "MyUsername";
$password = "MyPassword";
$url = "";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);


View 4 Replies

Parses Large Files Line By Line - Fseek() By Line 0 Not Bytes?

I have a script that parses large files line by line. When it encounters an error that it can't handle, it stops, notifying us of the last line parsed. Is this really the best / only way to seek to a specific line in a file? (fseek() is not usable in my case.)

for ($i = 0; $i < 100000; $i++)
fgets($fp); // just discard this

I don't have a problem using this, it is fast enough - it just feels a bit dirty. From what I know about the underlying code, I don't imagine there is a better way to do this.

View 2 Replies

Change The File Php.ini To Accept All Type Of Files To Be Uploaded In Line?

how i can change the file php.ini to accept all type of files to be uploaded in line

default_mimetype = "text/html"

i have a code to upload files but now i only upload text filehow can i specify this line to upload all kind of files

View 3 Replies

Creating An HTML File By Combining Multiple Files Via The Command Line?

Is it possible to combine multiple PHP files via the command line and create an HTML file? For example, this will save the rendered version of a single PHP file as HTML:

php /path/to/my/file/filename.php > /path/to/my/file/test.html

I need it to combine multiple files, but I can't seem to get it it to work. Ideally, it would be something like this:

php /path/to/my/file/filename.php + /path/to/my/file/filename2.php + /path/to/my/file/filename3.php > /path/to/my/file/test.html

View 3 Replies

.htaccess - Htaccess 301 Redirect Url?

I have a small dilema.I have been working on a project for almost a year now and had an old domain name. Not knowing how Google has index the whole site under the old domain which has worried me. I want to put the site up on my new domain name and I think doing a 301 is the way forward, but I will need to do this on every dynamic page. The good thing is the page structure is identical.

View 5 Replies

URL With .htaccess Or PHP Redirect?

I have a URL on my website that is currently under the directory

But I'd like to change the URL to

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 11 Replies

Redirect Url To Some Other Url Using .htaccess?

I am using following code into my .htaccess file at root folder of my webpage:

Options +SymLinksIfOwnerMatch
RewriteEngine on
rewritecond %{http_host} ^ [nc]
rewriterule ^(.*)$$1 [r=301,nc]
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?page=$1


I have no problem with the above code. But i want to prevent the following URL using .htaccess. Because this file exist on the main root and i can't check to see if it exists or not exist. The only way i understand is using .htaccess so that nobody can access it using this way.


Also is there anyway i can disallow Search Engine bots to not index these type of URL if found on the website using .htaccess?

View 1 Replies

Is It Session Redirect Or Htaccess?

I would like to have people who visit my site be forced to view the index first.
Such as, I have a view_video.php on my site and if they try to access this directly via favorites or a link they would be redirected directed to the index.php page and only be able to access pages on my site including the view_video.php page from the index page.

Reason being I have terms and conditions that must be agreed to before entering my site and if a link outside of my site is clicked it will send a user directly to the page without having to agree. I didn't want this to be a login type session but everyone has to agree before viewing all pages on my site.

I have searched high and low for this information and cannot seem to get it.
Javacript? Sessions? htaccess? Cookies? I am all over the place in my brain with this right now. If anyone can provide me with the simple answer and solution to what I seek, I will be in your debt forever.

View 24 Replies

Copyrights 2005-15, All rights reserved