Today's Messages (off)  | Unanswered Messages (on)

Forum: Htaccess Questions
 Topic: RewriteRule help
RewriteRule help [message #3267] Tue, 02 August 2011 13:45
strazdinjsh  is currently offline strazdinjsh
Messages: 2
Registered: July 2011
my one line of the code in .htaccess file is as follows:


RewriteRule ^andis-services/web-design/search-engine-optimization/page-( [^-]*)\.html$ index.php?m=1&s=3&p=$1 [L]


the link in simple php file looks like:


echo '<a href = " andis-services/web-design/search-engine-optimization/page-10 0.html ">test</a>';



the issue is that link does not target the same page all the time. after every click on it, i am getting redirection to:

2nd click goes to:

andis-services/web-design/search-engine-optimization/andis-s ervices/web-design/search-engine-optimization/page-100.html


3rd click goes to:

andis-services/web-design/search-engine-optimization/andis-s ervices/web-design/search-engine-optimization/andis-services /web-design/search-engine-optimization/page-100.html


etc.


Could anyone have a look on this case and give me some advice on it?
 Topic: rewrite
rewrite [message #3149] Tue, 26 July 2011 13:27
jonniejoejonson  is currently offline jonniejoejonson
Messages: 1
Registered: July 2011
The following rule works, but it changes the url in the address bar (I dont want it to)..
RewriteRule ^network/(.*)$ http://www.example.com/network.php?networkUrl=$1 [L]

The following rule redirects, the url stays the same, but all the images, includes in the network.php file become referenced incorrectly...
RewriteRule ^network/(.*)$ network.php?networkUrl=$1 [L]

Is there a way to make this work.
Thanks for your time...
Kind regards J
 Topic: rewrite help needed
rewrite help needed [message #3130] Mon, 25 July 2011 20:48
strazdinjsh  is currently offline strazdinjsh
Messages: 2
Registered: July 2011
Hello.

I am web developer newbie who creates the php class who converts the ugly look of the url to the friendly one. Result of the usage of this class is friendly url output and generated htaccess file with rules and conditions for particular urls.

Sample: I have some url who looks as follows:
index.php?a=1&b=2&c=3
, where any of these variables can have value {numbers, letters}. Variables values are collected from database tables.

a=1 => webtest_1
a=2 => webtest_2
...
a=x => webtest_x
-------------------------------
b=1 => photo_1
b=2 => photo_2
...
b=x => photo_x
--------------------------------
c=1 => pc_1
c=2 => pc_2
...
c=x => pc_x
--------------------------------
...
...
...
--------------------------------
z=1n => last_variable_1n
z=2n => last_variable_1n
...
z=xn => last_variable_xn



So, my htaccess contains something like:

Options +FollowSymlinks
RewriteEngine on

RewriteRule ^webtest_1/photo_2/pc_3\.html$ /index.php?a=1&b=2&c=3 [L]
RewriteRule ^webtest_2/photo_1/pc_1\.html$ /index.php?a=2&b=1&c=1 [L]
...
...
...


I have been done with this class so far - i am able to use it, only one disadvantage - lack of knowledge in htaccess coding. The htaccess file is huge and depends on the number of variables selected in url and number of rows assigned from the DB tables. I am looking for option to optimize it and speed up the loading of the web.

Could anyone advice and might be show how to use RewriteMap for my case. I have read a lot but have not got a solution for it.

Thank you in advance.
 Topic: htaccess mobile redirect
icon3.gif  htaccess mobile redirect [message #3112] Sun, 24 July 2011 18:35
terbush  is currently offline terbush
Messages: 1
Registered: July 2011
heyya....

STATS:
host = Godaddy w/linux
main dir structure = root (master index.html page and sub dirs)
sub dir structure = www.mysite.com/mobile/index.html

QUESTIONS:
so my main root folder has the index.html with heavy Flash. Google analytics is telling me that I am getting a lot of iOS and other mobile hits. BUT, the iOS is (obviously) not showing flash. so I want to redirect.

I can't figure out the code to put in the root .htaccess file
what I have tried ends up giving me a "too many redirects" errors.

current code:
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} iPhone|iPad|iTouch|iPod|palm||android
RewriteCond %{REQUEST_URI} !^/my-iPhone-site/
RewriteRule .* /mobile/ios/ [R]


I am looking to have the iphone, itouch, ipod go to one sub dir index page, ipad to another, and bb,palm,google-mobile etc etc go to another. AND have an option on the non iOS pages to have a "view full site" button that goes back to the root index.html page.


Thanks in advance for any assistance.
terbs
 Topic: Wordpress & osTicket
icon5.gif  Wordpress & osTicket [message #2990] Mon, 18 July 2011 14:46
JamesGeddes  is currently offline JamesGeddes
Messages: 1
Registered: July 2011
Location: London, England
Hi everyone,

I am working with a charity and have made a little internal tech support site at IUITHQ.co.cc using wordpress

In order to properly manage support requests, I have also installed osTicket at IUITHQ.co.cc/support however whenever I try to do anything within its "Staff Control Panel", wordpress wordpress kicks in and says that the page cannot be found!

I was wondering therefore, if you might be able to help me out with what .htaccess code I would need to use in order to stop wordpress from accessing the /support folder?

So far, I have this - which does not work!

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/support/.*$
RewriteCond %{REQUEST_URI} !^/support$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^index\.php$ - [L]
</IfModule>

# END WordPress


This is for a charity like I say so your help will be most gratefully appreciated!

Thanks everyone!

James

[Updated on: Mon, 18 July 2011 14:47]

 Topic: Hiding folder directory
icon5.gif  Hiding folder directory [message #2949] Fri, 15 July 2011 03:45
Arculos  is currently offline Arculos
Messages: 1
Registered: July 2011
Location: UK
I have a folder or folders I would like to hide, I've googled around for folder cloaking / hiding with no working result.

The current url setup
http://www.arculos.com/url-docs/portfolio/arculos-hub.php

Im trying to hide the "URL-docs" and if possible the "portfolio"
section of the url as well so I am left with either...

http://www.arculos.com/arculos-hub.php
orhttp://www.arculos.com/portfolio/arculos-hub.php

The current HTACCESS setup is shown below
# Hidden Folder Directories
#Url-docs
RewriteEngine on
RewriteRule ^/$ /url-docs/
 Topic: help!
help! [message #2933] Wed, 13 July 2011 23:45
rockuuu  is currently offline rockuuu
Messages: 1
Registered: July 2011
Hey Guys:
i need help please in htaccess
i have a very simple HTML design with simple PHP conatct us form , when i fill the form and hit the Submit button i get the Error 403 access forbidden
i googled this i make more than 20 script for htaccess file BUT not a single one make it work

i have no idea about it , would u please help me out here i would really apprciated it

i will post the HTML and PHP script :
Code:

<?php
$errors = '';
$myemail = '*****@****.com';
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['message']))
{
$errors .= "\n Error: all fields are required";
}

$name = $_POST['name'];
$email_address = $_POST['email'];
$message = $_POST['message'];

if (!preg_match(
" /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a -z]{2,3})$/i ",
$email_address))
{
$errors .= "\n Error: Invalid email address";
}

if( empty($errors))
{
$to = $myemail;
$email_subject = "Contact form submission: $name";
$email_body = "You have received a new message. ".
" Here are the details:\n Name: $name \n Email: $email_address \n Message \n $message";

$headers = "From: $myemail\n";
$headers .= "Reply-To: $email_address";

mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: contact-form-thank-you.html');
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Contact form handler</title>
</head>

<body>
<!-- This page is displayed only if there is some error -->
<?php
echo nl2br($errors);
?>


</body>
</html>

the htaccess file is (i tried too many scripts this what is in it NOW)


<Directory />
Allowoverride All
</Directory>

<Location />
Options +IncludesNoExec -ExecCGI
</Location>


the html form

Code:

<form method="POST" name="contactform" action="contact-form-handler.php">
<p>
<label for='name'>Your Name:</label> <br>
<input type="text" name="name">
</p>
<p>
<label for='email'>Email Address:</label> <br>
<input type="text" name="email"> <br>
</p>
<p>
<label for='message'>Message:</label> <br>
<textarea name="message"></textarea>
</p>
<input type="submit" value="Submit"><br>
</form>



maybe in the backage i bought with the hosting i didnt select this kind of services , its from 1AND1 by the way, i really dont know

Best regards
 Topic: Joomla...subdomains
Joomla...subdomains [message #2932] Wed, 13 July 2011 21:14
fhhost  is currently offline fhhost
Messages: 1
Registered: July 2011
Location: yorkshire ,uk
Hi there,

Im very confused with htaccess, I have subdomains and I wish to install demo
and other items, but everytime I go to visit the install or index of the subdomain.

SUBDOMAIN.DOMAIN.COM

it redirects me to the main domain.

DOMAIN.COM

Here is the file code on the root.

##
# @version $Id: htaccess.txt 14401 2010-01-26 14:10:00Z louis $
# @package Joomla
# @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##


#####################################################
#  READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations.  It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file.  If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's.  If they work,
# it has been set by your server administrator and you do not need it set here.
#
#####################################################

##  Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

#
#  mod_rewrite in use

RewriteEngine On

########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
## Deny access to extension xml files (uncomment out to activate)
#<Files ~ "\.xml$">
#Order allow,deny
#Deny from all
#Satisfy all
#</Files>
## End of deny access to extension xml files
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits

#  Uncomment following line if your webserver's URL
#  is not directly related to physical file paths.
#  Update Your Joomla! Directory (just / for root)

# RewriteBase /


########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section



kindest regards..

Jonathan
 Topic: Redirect then rewrite
Redirect then rewrite [message #2931] Wed, 13 July 2011 11:14
Sonofwan  is currently offline Sonofwan
Messages: 2
Registered: July 2011
Location: London
I've got long links to news articles www.xxxx.com/blah/blahblah=nice-seo-keywords-random# and for seo and human friendly reasons I shortened them using a rewriterule
RewriteRule ^news/(.*) /blah/blahblah=$1 [NC]

All good but what I'd also like to do is have a beer and kick back rather than go around the web and change all the old full links to canonicalise them. So I'm presuming - and stuck on - writing a redirect will do the trick..

Redirect 301 /blah/blahblah= http://www.xxxx.com/news/

Doesn't work.. Have tried putting the rewrite below and above the redirect.. Not sure if I'm barking up the right tree..

To explain my objective - I'd prefer the short links for future use and were viewable in the users address bar and by search engines, so any long links existing on the web will go to the right content but change the url to be the short one.

 Topic: Help with mod_rewrite!
Help with mod_rewrite! [message #2853] Thu, 07 July 2011 13:33
jayskates  is currently offline jayskates
Messages: 1
Registered: July 2011
Hi everyone,

I'm currently working on a pretty dynamic website... I'm trying to use htaccess to rewrite all the ugly urls into nice pretty ones!

I have the most basic rule working...

RewriteRule (.*)\.html$ index.php?p=$1

which is rewriting a url like
http://www.buschsystems.com/busch-new/index.php?p=Promotions

to
http://www.buschsystems.com/busch-new/Promitions.html


now here is where I'm stuck, I also want to rewrite url's that contain a second get variable,

Example:

http://www.buschsystems.com/busch-new/index.php?p=prod&name=Product Name

or
http://www.buschsystems.com/busch-new/index.php?p=About&subPage=Testimonials


How can I write these to be
http://www.buschsystems.com/busch-new/prod/Product Name.html

or
http://www.buschsystems.com/busch-new/About/testimonials.html


Any help would be greatly appreciated!! I have a deadline to meet (today) and would love to not miss it haha.

Thank you in advance!
 Topic: htaccess file please help
htaccess file please help [message #2828] Wed, 06 July 2011 18:35
dimvarlam  is currently offline dimvarlam
Messages: 1
Registered: July 2011
I've developed a site and need to make a rule for rewriting the url from:
www.my-site.com/pages/index.php?a=alpha&b=beta, to www.my-site.com/pages/alpha/beta/

I have already used an .htaccess file in folder "pages" but it keeps returning 500 internal error.

In the server's error I get:

[error] File does not exist: /home/my-site/public_html/500.shtml

[alert] /home/my-site/public_html/pages/.htaccess: Invalid command '{\\rtf1\\adeflang1033\\ansi\\ansicpg10000\\uc1\\adeff0\\def f0\\stshfdbch0\\stshfloch0\\stshfhich0\\stshfbi0\\deflang103 3\\deflangfe1033{\\upr{\\fonttbl{\\f0\\fnil\\fcharset0\\fprq 2{\\*\\panose', perhaps misspelled or defined by a module not included in the server configuration

The .htaccess file is as follows:

RewriteEngine On
RewriteBase /

RewriteRule ^([a-z]+)/([a-z]+)/$ index.php?a=$1&b=$2 [L]


Any help would be appreciated cause i'm stuck and unpaid for my work!!!

Thank's a lot in advance
 Topic: Is This A Forum For Making Questions?
Is This A Forum For Making Questions? [message #2811] Wed, 06 July 2011 07:03
storesonline  is currently offline storesonline
Messages: 2
Registered: July 2011
Location: USA
Please, look at my previous question I made about the htaccess and if you can answer it, I appreciate your interest.
In the other hand what is that all about games of golf?
 Topic: Moving forum to sub directory - htaccess help needed
Moving forum to sub directory - htaccess help needed [message #2770] Sun, 03 July 2011 16:33
crforum  is currently offline crforum
Messages: 1
Registered: July 2011
Location: India
Hello Folks,
I have a SMF forum installation at www.mydomian.com and I wish to move it to www.mydomain.com/forum and install wordpress at www.mydomain.com/
My challenge is the following:

I have thousands of Search Engine Listings. I need to redirect each page to the same pagein its new location at www.mydomain.com/forum. I have prettyurl installed and thus all the listings in Search Engines ends something like mydomain.com/category_name/page_name/. This means I may need some htaccess hack that will redirect visitors based upon what category their landing page exists inside. I don't have much knowledge of htaccess so I am requesting some expert help from you. I am sure this can be done.

Thanks for all the advice I can get here!
 Topic: How To tell The Search Engine To Ignore Files _vti_cnf Front Page?
icon10.gif  How To tell The Search Engine To Ignore Files _vti_cnf Front Page? [message #2767] Sun, 03 July 2011 00:17
storesonline  is currently offline storesonline
Messages: 2
Registered: July 2011
Location: USA
_vti_cnf. Does anyone knows? These are files that the program Frontpage creates and they should not be display or in cache, because they show errors in the webmaster reports, also it lowers the website ranking. too many errors are time consuming to fix one by one and maybe if you know how to tell these bots to ignore them? I appreciate it a lot.
 Topic: pretty url question
pretty url question [message #2666] Fri, 24 June 2011 04:52
minidawg  is currently offline minidawg
Messages: 1
Registered: June 2011
Location: Canada
I have an htaccess file that is supposed to make some particular URL's look better. Here is my code

Quote:
Options +FollowSymLinks
DirectoryIndex index.htm
RewriteEngine On

RewriteBase /myFolder
#
# Trailing slash check
# Don't fix direct file links
RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ $1/ [L,R=301]

#
# Finally, forward everything to your front-controller
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(main)/?$ home.php [L,NC]
RewriteRule ^(register)/?$ logreg.php [L,NC]


I also have
Quote:
<a base='../' target='_self' />

in my header.
so going to webname.com/main/ shows the home.php page, great! I played with it a bit, and got all the images, javascript, and ajax to work as well. Here's the catch: In Opera, Chrome, and FireFox all my images and javascript/ajax work. In IE9 it will only show images with full (http://www.webname.com/images/pic.png). Images with relative paths dont show up.. But they do in the other browsers..
I deleted my cache, cookies, etc etc. Restarted the browser and the computer, and nothing. Can someone here offer some insight as to why this isn't working very well?
Pages (24): [1  2  3  4  5  6  7  8  9  10  11  12  13  14  15    »]


Current Time: Wed Feb 8 16:32:34 CET 2012

Powered by: FUDforum 3.0.0.
Copyright ©2001-2009 FUDforum Bulletin Board Software