renaming url's without redirecting

  • michaelscheel
  • Born
  • Born
  • michaelscheel
  • Posts: 3

Post 3+ Months Ago

Hi

I'am an idiot when it comes to rewriting :D , so hoping some of you guys can help me...
i'am trying to rename url's without redirecting them.


---------------------------------- code from httacess ----------------------------------------------------------


<IfModule mod_deflate.c>
# DEFLATE by type - html, text, css, xml
AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml

# DEFLATE by type - javascript
AddOutputFilterByType DEFLATE application/x-javascript application/javascript text/javascript text/x-js text/x-javascript

# DEFLATE by extension
AddOutputFilter DEFLATE js css htm html xml
</IfModule>


## Uncomment this if FollowSymLinks is not already enabled on your server
#Options +FollowSymLinks

## Use mod rewrite
## Comment the line below if RewriteEngine not already enabled on your server
RewriteEngine On

## Uncomment the line below and change the path if your script is installed
## in a different path than the root folder of your domain

#RewriteBase /

RewriteRule ^index.html index.php [nc]
RewriteRule ^recent_ads.html recent_ads.php [nc]
RewriteRule ^register.html register.php [nc]
RewriteRule ^pre-register.html pre-register.php [nc]
RewriteRule ^login.html login.php [nc]
RewriteRule ^logout.html logout.php [nc]
RewriteRule ^favorites.html favorites.php [nc]
RewriteRule ^contact.html contact.php [nc]
RewriteRule ^listings.html listings.php [nc]
RewriteRule ^pre-submit.html pre-submit.php [nc]
RewriteRule ^([0-9]+)-([^\/]+)?/content.html$ content.php?id=$1 [nc,qsa]
RewriteRule ^([0-9]+)-([^\/]+)?/index.html$ index.php?category=$1 [nc,qsa]
RewriteRule ^([0-9]+)-([^\/]+)?/details.html$ details.php?id=$1 [nc,qsa]
RewriteRule ^([^\/]+)/([^\/]+)/([^\/]+)/recent_ads.html$ recent_ads.php?page=$&order=$2&order_way=$3 [nc,qsa]
RewriteRule ^([0-9]+)-([^\/]+)?/user_listings.html$ user_listings.php?id=$1 [nc,qsa]
RewriteRule ^([0-9]+)-([^\/]+)?/([^\/]+)/([^\/]+)/([^\/]+)/user_listings.html$ user_listings.php?id=$1&page=$3&order=$4&order_way=$5 [nc,qsa]
RewriteRule ^([^\/]+)/([^\/]+)/([^\/]+)/favorites.html$ favorites.php?page=$1&order=$2&order_way=$3 [nc,qsa]
RewriteRule ^([0-9]+)-([^\/]+)?/store.html$ store.php?id=$1 [nc,qsa]
RewriteRule ^([0-9]+)-([^\/]+)?/([^\/]+)/([^\/]+)/([^\/]+)/store.html$ store.php?id=$1&page=$3&order=$4&order_way=$5 [nc,qsa]

## Uncomment the following line when activating location subdomains
## Don't forget to replace (domain removed) with your own domain name !

#RewriteCond %{HTTP_HOST} !(domain removed)$ [NC]
#RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-_]+).(domain removed) [NC]
#RewriteRule (.*) %{SCRIPT_FILENAME}?crt_city=%2 [NC,QSA]

RewriteCond %{REQUEST_URI} ^(.*)(/listings.html)(.*)$ [NC]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule (.*) ./listings.php?$1
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • this213
  • Guru
  • Guru
  • User avatar
  • Posts: 1260
  • Loc: ./

Post 3+ Months Ago

What are you trying to rewrite? There's already a lot of rewriting going on from what I see here.

Code: [ Select ]
RewriteRule ^index.html index.php [nc]

this means take a url like "http://mydomain.com/index.html" and change it to "http://mydomain.com/index.php" - the user only sees "index.html", it doesn't change anything in the address bar. If you'd rather people go to "http://mydomain.com/mypage" (for example), you could rewrite it like so:
Code: [ Select ]
RewriteRule ^mypage index.php [nc]


I think this is what you're asking anyway.
  • michaelscheel
  • Born
  • Born
  • michaelscheel
  • Posts: 3

Post 3+ Months Ago

thank you so mutch for your reply

but i only want to change the url name, not redirect it if that's possible
  • this213
  • Guru
  • Guru
  • User avatar
  • Posts: 1260
  • Loc: ./

Post 3+ Months Ago

I have no idea what you mean, URLs don't have a "name". There's no redirection going on here, which would be denoted with [R] at the end.

The only thing like redirection I see is this:
Code: [ Select ]
RewriteCond %{REQUEST_URI} ^(.*)(/listings.html)(.*)$ [NC]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule (.*) ./listings.php?$1
  1. RewriteCond %{REQUEST_URI} ^(.*)(/listings.html)(.*)$ [NC]
  2. RewriteCond %{SCRIPT_FILENAME} !-f
  3. RewriteCond %{SCRIPT_FILENAME} !-d
  4. RewriteRule (.*) ./listings.php?$1

This means if listings.html is called, or something is called that isn't a file or a directory, then send through listings.php (which must be some form of search function) with the request as the query to the search. This isn't really redirection either though, the bogus called URI is simply aliased to listings.php. The address in the location bar doesn't (or shouldn't) change - which is actually what redirection does.

What, specifically, is being redirected that you don't want?
  • michaelscheel
  • Born
  • Born
  • michaelscheel
  • Posts: 3

Post 3+ Months Ago

like a slug can i rename a url,

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 126 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.