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 05-06-2018, 09:14 PM   #1
freecartoonporn
Confirmed User
 
freecartoonporn's Avatar
 
Industry Role:
Join Date: Jan 2012
Location: NC
Posts: 7,683
strange .htaccess issue

i am trying to rewrite urls on WAMP using .htaccess

i want this

Code:
www.example.com/item/1234
to redirect to this

Code:
www.example.com/item.php?id=1234
so i have this in my .htaccess

Code:
RewriteEngine On

RewriteRule ^item/([0-9]+)$ item.php?id=$1  [L]
but now all internal links are prefixed with /item/

this

Code:
<link rel="stylesheet" href="css/style.css">
becomes this

Code:
<link rel="stylesheet" href="item/css/style.css">
this is the first time i am having this kind of issue.,
i have used same config in nginx and it used to work fine on lemp.

but on wamp its screwing all the relative links.

what is wrong ?


i know i can define base url in html, but i want to know what is messing this and why now ?

is it wamp ?


Thanks for your time.
freecartoonporn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-07-2018, 05:16 AM   #2
NatalieK
Natalie K
 
NatalieK's Avatar
 
Industry Role:
Join Date: Apr 2010
Location: Spain
Posts: 19,403
If correct, you´re trying to make sure your concealing the directory "item" by opening page item.php...

why not just add page index.php in this directory, thus it always opens when going to this directory & here you can just redirect index.php to item.php
__________________
My official site Custom vids Make money & get into the businessFirst time girls
Skype: GspotProductions - "Converting traffic into income since 2005"
NatalieK is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-07-2018, 05:58 AM   #3
redwhiteandblue
Bollocks
 
redwhiteandblue's Avatar
 
Industry Role:
Join Date: Jun 2007
Location: Bollocks
Posts: 2,793
Because he probably doesn't want query strings in his URLs, doesn't want to have to physically create the directory and doesn't want to redirect the browser at all?

But i don't know anything about using htaccess on WAMP so I can't help. I wouldn't be surprised if the regex is totally different to Linux.
redwhiteandblue is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-07-2018, 06:04 AM   #4
NatalieK
Natalie K
 
NatalieK's Avatar
 
Industry Role:
Join Date: Apr 2010
Location: Spain
Posts: 19,403
Quote:
Originally Posted by redwhiteandblue View Post
Because he probably doesn't want query strings in his URLs, doesn't want to have to physically create the directory and doesn't want to redirect the browser at all?

But i don't know anything about using htaccess on WAMP so I can't help. I wouldn't be surprised if the regex is totally different to Linux.
true dat.

if it´s not possible, then the simple index.php and redirect is an easy option though
__________________
My official site Custom vids Make money & get into the businessFirst time girls
Skype: GspotProductions - "Converting traffic into income since 2005"
NatalieK is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-07-2018, 06:55 AM   #5
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
Quote:
Originally Posted by freecartoonporn View Post
i am trying to rewrite urls on WAMP using .htaccess

i want this

Code:
www.example.com/item/1234
to redirect to this

Code:
www.example.com/item.php?id=1234
so i have this in my .htaccess

Code:
RewriteEngine On

RewriteRule ^item/([0-9]+)$ item.php?id=$1  [L]
but now all internal links are prefixed with /item/

this

Code:
<link rel="stylesheet" href="css/style.css">
becomes this

Code:
<link rel="stylesheet" href="item/css/style.css">
this is the first time i am having this kind of issue.,
i have used same config in nginx and it used to work fine on lemp.

but on wamp its screwing all the relative links.

what is wrong ?


i know i can define base url in html, but i want to know what is messing this and why now ?

is it wamp ?


Thanks for your time.
mod_negotiation - Apache HTTP Server Version 2.4
Try disabling this, you probably have it on.
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-07-2018, 09:01 AM   #6
freecartoonporn
Confirmed User
 
freecartoonporn's Avatar
 
Industry Role:
Join Date: Jan 2012
Location: NC
Posts: 7,683
Quote:
Originally Posted by k0nr4d View Post
mod_negotiation - Apache HTTP Server Version 2.4
Try disabling this, you probably have it on.
still nope.


Code:
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^item/([0-9]+)$ item.php?id=$1  [L]
freecartoonporn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-08-2018, 05:17 AM   #7
zerovic
Confirmed User
 
zerovic's Avatar
 
Industry Role:
Join Date: Apr 2010
Posts: 1,101
Hey man,

simply change the way you include your css file

instead of using this

<link rel="stylesheet" href="css/style.css">

add it like this, with a leading slash

<link rel="stylesheet" href="/css/style.css">

if you use it without the leading slash, it will use the current url displayed in the browser.. if you add the leading slash, it will use the root domain

if you still have troubles with it, add this to your .htaccess before the RewriteEngine On command

RewriteRule ^css - [L,NC]

this will completely ignore the css directory from any rewrite rule

ps. tested it, it works

if you can't make it work, feel free to contact me

cheers,
z
__________________
php, html, jquery, javascript, wordpress - contact me at contact at zerovic.com
zerovic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-09-2018, 05:33 PM   #8
freecartoonporn
Confirmed User
 
freecartoonporn's Avatar
 
Industry Role:
Join Date: Jan 2012
Location: NC
Posts: 7,683
Quote:
Originally Posted by zerovic View Post
Hey man,

simply change the way you include your css file

instead of using this

<link rel="stylesheet" href="css/style.css">

add it like this, with a leading slash

<link rel="stylesheet" href="/css/style.css">

if you use it without the leading slash, it will use the current url displayed in the browser.. if you add the leading slash, it will use the root domain

if you still have troubles with it, add this to your .htaccess before the RewriteEngine On command

RewriteRule ^css - [L,NC]

this will completely ignore the css directory from any rewrite rule

ps. tested it, it works

if you can't make it work, feel free to contact me

cheers,
z
this solved my issue.,
Thank you.
freecartoonporn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-10-2018, 07:19 PM   #9
Bladewire
StraightBro
 
Bladewire's Avatar
 
Industry Role:
Join Date: Aug 2003
Location: Monarch Beach, CA USA
Posts: 56,229
↑↑↑ Awesome!
__________________


Skype: CallTomNow

Bladewire 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

Tags
wamp, .htaccess, time, issue, links, fine, nginx, config, lemp, messing, html, url, relative, wrong, define, base, screwing, rewriteengine, rewriterule, redirect, www.example.com/item/1234, rewrite, urls, ^item/[0-9]+$, item.php?id=$1



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.