Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 10-07-2011, 11:31 PM   #1
acctman
Confirmed User
 
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
htaccess rewrite remove file extension?

anyone have an example of how to write url file extension

specific rewrite...
http://www.site.com/members.html to http://www.site.com/main

and then remove all extension for all files ending in *.html
http://www.site.com/*.html to http://www.site.com/*

also this needs to work with and without www

my current htaccess
Code:
<IfModule mod_rewrite.c>
RewriteEngine On		
RewriteCond %{HTTP_HOST} ^(ssss\.com)$ [NC] 
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$ 
RewriteCond %{HTTP_HOST} !^(www\.)?ssss\.com$ [NC] 
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.ssss\.com$ [NC] 
RewriteRule ^(.*)$ http://www.ssss.com/view/%2.html [R=301,L]
RewriteCond %{REQUEST_URI} !^files/
RewriteCond %{REQUEST_FILENAME}  !-d
RewriteCond %{REQUEST_FILENAME}  !-f
RewriteRule ^(.*) index.php [L]
</IfModule>

Last edited by acctman; 10-07-2011 at 11:35 PM..
acctman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-08-2011, 07:09 AM   #2
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,290
Quote:
Originally Posted by acctman View Post
anyone have an example of how to write url file extension

specific rewrite...
http://www.site.com/members.html to http://www.site.com/main

and then remove all extension for all files ending in *.html
http://www.site.com/*.html to http://www.site.com/*

also this needs to work with and without www

my current htaccess
Code:
<IfModule mod_rewrite.c>
RewriteEngine On		
RewriteCond %{HTTP_HOST} ^(ssss\.com)$ [NC] 
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$ 
RewriteCond %{HTTP_HOST} !^(www\.)?ssss\.com$ [NC] 
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.ssss\.com$ [NC] 
RewriteRule ^(.*)$ http://www.ssss.com/view/%2.html [R=301,L]
RewriteCond %{REQUEST_URI} !^files/
RewriteCond %{REQUEST_FILENAME}  !-d
RewriteCond %{REQUEST_FILENAME}  !-f
RewriteRule ^(.*) index.php [L]
</IfModule>
need more descriptive what you want.

but here is the basis


Quote:
Options +FollowSymLinks
RewriteEngine On

# which do you want?

# make /members.html use /main
RewriteRule ^members.html /main [NC]

# make /main use /members.html
RewriteRule ^main /members.html [NC]

# alias /filename.html to /filename (dont know if you want to redirect the .html to the non or just make it work without

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L,QSA]
hope this helps you out somewhat.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-08-2011, 01:44 PM   #3
acctman
Confirmed User
 
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
Quote:
Originally Posted by fris View Post
need more descriptive what you want.

but here is the basis




hope this helps you out somewhat.
/members.html use /main is exactly what I wanted. not sure which to use for the next part where I want all urls with .html to have the alias of there filename ... whatever.html would be /whatever
acctman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-08-2011, 04:32 PM   #4
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,290
that will work then, i used to use something like that for arylia, since tgps didnt like .php files being submitted, i aliased .html to .php
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-09-2011, 08:44 AM   #5
acctman
Confirmed User
 
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
Quote:
Originally Posted by fris View Post
that will work then, i used to use something like that for arylia, since tgps didnt like .php files being submitted, i aliased .html to .php
thanks. how did you become so good with htaccess mod_rewrites?
acctman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-09-2011, 01:20 PM   #6
georgeyw
58008 53773
 
georgeyw's Avatar
 
Industry Role:
Join Date: Jul 2005
Location: Australia
Posts: 9,864
Quote:
Originally Posted by acctman View Post
thanks. how did you become so good with htaccess mod_rewrites?


http://www.generateit.net/mod-rewrite/
georgeyw is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-09-2011, 06:42 PM   #7
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,290
Quote:
Originally Posted by georgeyw View Post
never found a generator to do many of the stuff I do

Code:
# enables domain.com/search/search-term.html 

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^search/(.+)\.html$ /index.php?s=$1 [QSA,L]
Code:
# make /pics/askj12.jpg work as /askj12.jpg

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/data%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}/data%{REQUEST_URI} -d
RewriteRule !^pics(/.*)?$ /pics%{REQUEST_URI} [QSA,L]
Code:
# from: http://www.example.com/profile.php?user=username 
# to: http://username.example.com 

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteRule .* - [L]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.example\.com$ [NC]
RewriteRule ^$ /profile.php?user=%1 [QSA,L]
Code:
# rewrite rules to generate on the fly

# /sub/evil.domain.com/pics --> http://evil.domain.com/pics
# /sub/content.domain2.com/clicks --> http://content.domain2.com/clicks
# /sub/ab.domain3.com/moo --> http://ab.domain3.com/moo

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?[^\.]+\.[^\.]+$ [NC]
RewriteCond %{HTTP_HOST} ^(.*\.)?([^\.]+\.[^\.]+\.[^\.]+)$ [NC]
RewriteCond %{DOCUMENT_ROOT}/sub/%2%{REQUEST_URI}/ -d
RewriteRule [^/]$ http://%2%{REQUEST_URI}/ [R=301,L]
RewriteCond %{HTTP_HOST} ^(.*\.)([^\.]+\.[^\.]+\.[^\.]+)$ [NC]
RewriteRule ^(.*)$ http://%2/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^(www\.)?[^\.]+\.[^\.]+$ [NC]
RewriteCond %{HTTP_HOST} ^([^\.]+\.[^\.]+\.[^\.]+)$ [NC]
RewriteCond %1:::%{REQUEST_URI} !^(.+):::/sub/\1(/.*)?$ [NC]
RewriteCond %{DOCUMENT_ROOT}/sub/%1/ -d
RewriteRule ^(.*)$ /sub/%1/$1 [QSA,L]
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.