Jump to content

Re-Writing URL with .htaccess don't works with multiple re-writes dynamic


arifKHAN

Recommended Posts

I have a trouble in making fancy URL's with .htaccess file.

I'm saving titles in database like "name-of-a-title" but problems starts when i try to access it from URL, it don't show me a css on page only content.

This URL for blog now work like

http://my-website.com/blog?title=page-title

and i need URL like this

http://my-website.com/blog/post-title

Here is mine file, i'm begginer so don't blame me please. Thanks in advance.

<files .htaccess>
order allow,deny
deny from all

</files>

RewriteEngine On
RewriteRule ^blog$ blog.php
RewriteRule ^blog/$ blog.php
RewriteRule ^blog/([^/]*)$ /blog?title=$1 [L]

RewriteEngine On
RewriteRule ^category/([^/]*)$ category.php?$1 [L]


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# To externally redirect /dir/abc.php to /dir/abc
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(.+?)\.php[\s?] [NC]
RewriteRule ^ /%1 [R=301,L,NE]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [QSA,NC,L]

</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^\.]+)$ $1.php [QSA,NC,L]

</IfModule>

RewriteEngine On
RewriteCond %{HTTP_HOST} ^my-webiste.com
RewriteRule (.*) http://www.my-website.com/$1 [R=301,L]

RewriteEngine On
ErrorDocument 404 /404.php

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.