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]

ADVERTISEMENT

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

Jul 9, 2010

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)
[Code]....

View 3 Replies View Related

Redirect Using .htaccess File?

Mar 9, 2010

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 View Related

.htaccess Redirect If File Exists

Jun 10, 2011

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 View Related

A Line In .htaccess File?

Mar 23, 2011

ErrorDocument 404 /index.php

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

View 4 Replies View Related

Htaccess Rewrite Rule To Redirect To File Or Not?

Jun 9, 2010

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]
</IfModule>

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 View Related

.htaccess Redirect If File Doesn't Exist?

Mar 20, 2009

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 View Related

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

Nov 3, 2009

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:

/var/www/html/somefolder/program.php?css=1

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 View Related

Htaccess Rewrite - Folder Redirect To File

Jul 7, 2010

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
[Code]....

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 View Related

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

Oct 29, 2010

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

RewriteCond %{HTTP_HOST} ^(.*).example.com
RewriteCond %{HTTP_HOST} !^www.example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/ [P]

Would this mean that if I was to type in elephant.example.com it would redirect and show www.example.com 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 View Related

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

Jul 4, 2011

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)

[Code].....

View 2 Replies View Related

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

Jan 24, 2010

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 View Related

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

May 12, 2011

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 View Related

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

Aug 6, 2010

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 View Related

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

Jan 5, 2004

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 View Related

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

Jan 5, 2009

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 View Related

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

Jun 28, 2007

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 View Related

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

Oct 16, 2010

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.

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

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

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

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 View Related

.htaccess - Download Htaccess Protected Files Using CURL

Feb 9, 2011

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

$username = "MyUsername";
$password = "MyPassword";
$url = "http://www.example.com/private/file.pdf";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

[Code]...

View 4 Replies View Related

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

Aug 27, 2010

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.)

<?php
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 View Related

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

Jul 13, 2009

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 View Related

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

Feb 16, 2011

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 View Related

.htaccess - Htaccess 301 Redirect Url?

Jul 8, 2011

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 View Related

URL With .htaccess Or PHP Redirect?

Jul 16, 2005

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

Redirect Url To Some Other Url Using .htaccess?

May 20, 2011

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

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

[code]....    

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.

[URL]

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 View Related

Is It Session Redirect Or Htaccess?

Aug 31, 2007

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 View Related

.htaccess To Redirect To Https://

Jul 6, 2005

Recently our site was converted to a secure site (https://) and this works fine. The problem is the normal http pages are still accessable. We contacted our hosting companies tech support and they said this was out of thier range of support but to check up on using the htaccess file.

View 7 Replies View Related

Problem With .htaccess 404 Redirect

Sep 14, 2007

I'm using the following code to do a 404 redirect..

ErrorDocument 404 index.php

BUT when I go to execute a nonexistent file, the browser simply outputs "index.php" --- that's it.

If I change the code to redirect to an external website like yahoo, that works just fine

Code: ErrorDocument 404 http://yahoo.com

But why isn't my own page being executed?

View 1 Replies View Related

Redirect A Page Using Htaccess?

Mar 2, 2011

I need to redirect a page like www.someone.com/2011/03/05 to sample.php?dt=2011/03/05 using htaccess and php.

View 3 Replies View Related

CodeIgniter Htaccess Redirect?

Mar 24, 2010

I'm hoping that this will be a simple question that someone can answer. I'm looking to build a CodeIgniter application that I can build pretty easily in regular PHP.Example: I would like to go to http://locahost/gregavola and have rewritten using htaccess file to profile.php?user=gregavola. How can I do this in CodeIgniter? access I could write ^(w+)$ profile.php?user=$1 but that won't work with the paths in CodeIgniter.

View 2 Replies View Related

.htaccess Rewrite Redirect?

Aug 3, 2010

I have some code which uses Rewrite engine in my .htaccess file and it specifies the directory for my SERPs. However when someone goes onto search/QUERY/ rather than search/QUERY/PAGE/ it displays a 404 error. Same with just search/.

I want it so that if someone just goes to search/QUERY/ that it redirects them to search/QUERY/1/ and for just search/ it redirects them to my homepage /. I have included a copy of my code below.

RewriteEngine on
RewriteRule ^search/([^/]+)/([^/]+)/?$ search.php?q=$1&category=web&d=$2

View 3 Replies View Related

Redirect To Www With .htaccess Not Redirecting?

Jun 6, 2011

Im have absolutely no experience with .htaccess and i tried something today. I basicly wanted all my pages[URL]again i had absolutely no idea what i was doing and i just copy pasted this

RewriteCond %{HTTP_HOST} !^www.example.com [NC]
RewriteRule ^(.*) http://example.com/$1 [L,R=301]

into a .htaccess file in my public_html directoryi tested going into a http://www site but nothing happened, so i just deleted everything in the .htaccess file as it was in the beginning, totally bank.so i tested this

# Redirect to www
RewriteCond %{HTTP_HOST} !^(www.example.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

[code]...

View 1 Replies View Related

Htaccess Redirect URL To Page?

Mar 31, 2011

I want to redirect a particular page using a 301 but my htaccess is also redirecting pages that contain the same start. Example:

I want to redirect:

[URL]

To:

[URL]

My current rule is

RewriteRule ^advantage "index.php?page=some advantage" [L,R=301]

This rule also redirects

[URL]

To the "some advantage" page

View 2 Replies View Related

Redirect Of A Specific URL Htaccess?

May 26, 2011

I tried to apply the solution in this answer to redirecting problem. Doesn't seem to work. I'm stumped. I need to redirect [URL] to [URL].

The code I tried is below:

RewriteEngine On
RewriteCond %{QUERY_STRING} (^|&)m=product_detail(&|$)
RewriteCond %{QUERY_STRING} !(^|&)p=7
RewriteRule cart.php /shop/category-page/product-page-c23/

View 1 Replies View Related

Use Htaccess To Redirect Everyone Except IP To Page?

Jun 24, 2010

On my various website's I've tried to use the .htaccess file and one of the things I can't find how to do is redirecting everyone except me to a certain page.Basically my IP would see whatever page but anyone else who goes to the directory would be sent to another page.

View 2 Replies View Related

Redirect To A Sub Folder Using .htaccess?

Aug 16, 2010

I moved a website over to a sub folder and I added a htaccess file to the root of the site. For some reason it is not redirecting to the subfolder. below is my code

Options +FollowSymLinks
#
# mod_rewrite in use
RewriteEngine on
RewriteBase /public_html/corp/

i also tried

Options +FollowSymLinks
#
# mod_rewrite in use
RewriteEngine on
RewriteBase /corp/

The site is actually in a folder called /corp/

View 2 Replies View Related

.htaccess - Redirect To Login.php?

Nov 25, 2009

I have a web folder named 'myApplication'.This folder contains php (index.php , login.php, addApp.php, editApp.php, and so on)files and folders. I want all the users to access login.php first. For e.g. If someone requests login.php at first then fine. But if someone requests addApp.php (or any other file) before accessing login.php then I want them to redirect to login.php. I was trying to do this with session but could not succeed due to some application specific constraints. Now how can I write a .htaccess file to define such policy.

View 7 Replies View Related

Redirect Rule For .htaccess?

Jul 9, 2010

Below is code as of now in my .htaccess

RewriteRule ^series/([^/]*)-([^/]*)-schedule-fixtures.php$ /viewseries.php?id=$1 [L]
RewriteRule ^schedule/([^/]*)-([^/]*).php$ /viewschedule.php?id=$1 [L]
RewriteRule ^venue/([^/]*).php$ /viewvenue.php?vcity=$1 [L]
RewriteRule ^team/([^/]*).php$ /viewteam.php?team=$1 [L]
RewriteRule ^month/([^/]*).php$ /viewmonth.php?month=$1 [L]

Now, Problem is that it doesn't show redirect 301 to google or anyone other. what should I do to show redirect message to google.I tried adding R=301 but that redirected to wrong url

View 4 Replies View Related

Redirect From A Folder .htaccess?

Nov 2, 2010

I need to be able to get a folder name, the folder name based on the name of the website member eg [URL] it would then get the username John123 and then use this information to access his account. The files the server would get would be from something like: [URL] but would show to the user as [URL] I have looked every where, and cant find anything. But I know it can be done as I have come accross this before, a couple of year back!

View 2 Replies View Related

Htaccess Redirect Add Querystring?

Apr 12, 2011

I'm triying to redirect [URL]......?lang=enAny try i made redirect all the traffic in the website or creates a loop.

View 2 Replies View Related

Passing Along Variables During A Htaccess 301 Redirect

May 22, 2007

I have a form people fill out on my website, and on submit they are then sent to an appropriate document depending on their input.

Some people link directly to those documents instead of to my form page which the preferred method. Therefore I added to my .htacess a 301 redirect to the form page for visitors requesting documents with a referer other than blank or from my domain.

The 301 redirect is important to me so people's address bars change to the matching page, and for search engines to accredit the form page for the incoming links.

My only concern is, once there, the visitor will see an empty form. For usability, I would strongly like to send which document the user requested to the form page, so once loaded, the form will be pre filled out for their appropriate document.

I would know how to do this using my .htaccess page if I wanted to have that document name in the address bar, but I would strongly like to have the address bar be the normal form page address.

Is it possible that in the redirect I can send that variable in a POST type method, where the information is not visible in the address bar?

I guess if I can't do the first I could redirect the visitor to an intermediary page that just reads the variable in the link and stores that value in a cookie before sending the visitor off the the form page.

View 1 Replies View Related

.htaccess Subdomain Redirect To It's Folder

Sep 19, 2006

how can i use .htaccess to make a certain subdomain redirect to it's
subfolder in the www/

ex: test.domain.com would redirect to domain/test

View 2 Replies View Related

Htaccess And Php Header Redirect Problems.

Oct 17, 2007

I was running a site on a semi-dedicated server and 2 days ago I switched to a brand new hosting company for a dedicated server.

When the site first started working, I noticed header errors saying the session output or headers were already being started by output. I dont remember the exact error but I know it said something about headers and sessions. Code:

View 2 Replies View Related

Class - .htaccess Redirect Or Change?

Jan 21, 2011

The main navigation of my site is coded like this:

<li><a href="index.php?pageID='.$key.'">'.$value.'</a></li>'."
";

But I would like the URL of the links to look like domain.co.nz/pagename, not domain.co.nz/index.php?pageId=pagename

How would you recommend I accomplish this?

View 2 Replies View Related

.htaccess - Redirect Post Data?

Dec 11, 2008

I have a website where all requests are redirected silently (via .htaccess) to index.php and then PHP is used to show the correct page (by traversing the REQUEST_URI). I was wondering if it's possible to submit POST data to a fake address too? I've currently got my form like so

<form action="/whatplant/send-mail" method="post" id="contact-us-form">

And my .htaccess rule is

# redirect mail posting to index
RewriteRule send-mail index.php?send-mail [NC,L]

My index.php checks isset($_GET['send-mail']) which works fine. This however seems to drop off all the POST data that should be sent to it. Is there a way to keep the post data? I don't want to use GET because it can't send as much information, though it might not be an issue with a simple enquiry form.

EDIT: I changed the form's action to a test.php with print_r($_POST) and got the correct output. I am still having problems receiving the post data when the action is sent to index.php

Here is my .htaccess for redirecting to index.php

# serve files and dirs if they exist please, otherwise send to index
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php

View 4 Replies View Related

ADVERTISEMENT